e2c0845145
- cloudapi-gql@1.0.4 - joyent-cp-frontend@1.1.0 - joyent-cp-gql-mock-server@1.0.4 - joyent-cp-gql-schema@1.0.4 - joyent-cp-rdb-bootstrap@1.0.4 - normalized-styled-components@1.0.5 - pseudo-json-ast@1.0.6 - pseudo-yaml-ast@1.0.6 - remcalc@1.0.5 - rnd-id@1.0.5 - styled-is@1.0.7 - joyent-ui-toolkit@1.1.0 - unitcalc@1.0.5 |
||
---|---|---|
.. | ||
src | ||
test | ||
.eslintignore | ||
.eslintrc | ||
.tern-project | ||
CHANGELOG.md | ||
package.json | ||
README.md | ||
yarn.lock |
remcalc
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