Skip to content

yldio/unitcalc

Repository files navigation

unitcalc

npm License: MPL 2.0 standard-readme compliant Greenkeeper badge

David David

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published