joyent-portal/packages/remcalc
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

remcalc

License: MPL 2.0 npm standard-readme compliant

Calculate the rem's from px values.

Table of Contents

Install

yarn add --dev remcalc

Usage

import remcalc from 'remcalc';
import assert from 'assert';


assert.deepEqual(remcalc.withBase(10, 1, 2, 3, 4), '0.1rem 0.2rem 0.3rem 0.4rem');

assert.deepEqual(remcalc('1'), '0.0625rem');

assert.deepEqual(remcalc('1px'), '0.0625rem');

assert.deepEqual(remcalc.withBase(10, '1px'), '0.1rem');

assert.deepEqual(
  remcalc('1', '2', '3', '4'),
  '0.0625rem 0.125rem 0.1875rem 0.25rem'
);

assert.deepEqual(
  remcalc('1px', '2px', '3px', '4px'),
  '0.0625rem 0.125rem 0.1875rem 0.25rem'
);

assert.deepEqual(
  remcalc.withBase(10, '1', '2', '3', '4'),
  '0.1rem 0.2rem 0.3rem 0.4rem'
);

assert.deepEqual(
  remcalc.withBase(10, '1px', '2px', '3px', '4px'),
  '0.1rem 0.2rem 0.3rem 0.4rem'
);

assert.deepEqual(remcalc('1 2 3 4'), '0.0625rem 0.125rem 0.1875rem 0.25rem');

assert.deepEqual(remcalc.withBase(10, '1 2 3 4'), '0.1rem 0.2rem 0.3rem 0.4rem');

License

MPL-2.0