joyent-portal/packages/unitcalc
2017-09-08 10:56:07 +01:00
..
src chore: restore removed packages 2017-06-16 21:46:36 +01:00
test chore: restore removed packages 2017-06-16 21:46:36 +01:00
.eslintignore style: ignore dist folders for lint 2017-09-08 10:56:07 +01:00
.eslintrc chore: restore removed packages 2017-06-16 21:46:36 +01:00
.tern-project chore: restore removed packages 2017-06-16 21:46:36 +01:00
CHANGELOG.md fix(cp-frontend,ui-toolkit): increase synchrony between wireframes and code 2017-09-07 16:02:29 +01:00
package.json feat(joyent-boilerplate): initial commit 2017-09-07 17:28:56 +01:00
README.md fix(cp-frontend,ui-toolkit): increase synchrony between wireframes and code 2017-09-07 16:02:29 +01:00

unitcalc

License: MPL 2.0 npm standard-readme compliant

Calculate the rem's from unit values.

Table of Contents

Install

yarn add --dev unitcalc

Usage

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