2017-05-18 21:21:33 +03:00
|
|
|
# unitcalc
|
|
|
|
|
2017-06-01 00:35:35 +03:00
|
|
|
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
|
|
|
|
[![npm](https://img.shields.io/npm/v/unitcalc.svg)](https://npmjs.com/package/unitcalc)
|
|
|
|
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)
|
2017-05-18 21:21:33 +03:00
|
|
|
|
|
|
|
Calculate the `rem`'s from unit values.
|
|
|
|
|
|
|
|
## Table of Contents
|
|
|
|
|
|
|
|
- [Install](#install)
|
|
|
|
- [Usage](#usage)
|
|
|
|
- [License](#license)
|
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
```
|
|
|
|
yarn add --dev unitcalc
|
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```js
|
|
|
|
import unitcalc from 'unitcalc';
|
|
|
|
import assert from 'assert';
|
|
|
|
|
|
|
|
|
|
|
|
assert.deepEqual(unitcalc(1, 2, 3, 4), '0.375rem 0.75rem 1.125rem 1.5rem');
|
|
|
|
|
|
|
|
assert.deepEqual(unitcalc('1'), '0.375rem');
|
|
|
|
|
|
|
|
assert.deepEqual(unitcalc.withBase(10, '1'), '0.625rem');
|
|
|
|
|
|
|
|
assert.deepEqual(
|
|
|
|
unitcalc('1', '2', '3', '4'),
|
|
|
|
'0.375rem 0.75rem 1.125rem 1.5rem'
|
|
|
|
);
|
|
|
|
|
|
|
|
assert.deepEqual(
|
|
|
|
unitcalc.withBase(10, '1', '2', '3', '4'),
|
|
|
|
'0.625rem 1.25rem 1.875rem 2.5rem'
|
|
|
|
);
|
|
|
|
|
|
|
|
assert.deepEqual(unitcalc('1 2 3 4'), '0.375rem 0.75rem 1.125rem 1.5rem');
|
|
|
|
|
|
|
|
assert.deepEqual(
|
|
|
|
unitcalc.withBase(10, '1 2 3 4'),
|
|
|
|
'0.625rem 1.25rem 1.875rem 2.5rem'
|
|
|
|
);
|
|
|
|
```
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
MPL-2.0
|