css-truncate-values

0.1.4 • Public • Published

css-truncate-values NPM version Build Status

Truncate CSS numbers while retaining the original value.

truncate('0.10em');
// => '.1em'
 
truncate('010.050ms');
// => '10.05ms'
 
truncate(['11.0s', '-06em', '-0.10rem']);
// => ['11s', '-6em', '-.10rem']

It will return the smallest possible version of any number while retaining the original value... The way it should be. 😄

Installation

$ npm install --save css-truncate-values

API

truncate(values)

Remove the inconsistencies from CSS numbers while keeping the same value.

  • values (String|Array) A value or array of values that you want to truncate.
truncate('00.80s');
// => '.8s'
 
truncate(['04px', '0.010px']);
// => ['4px', '.01px']

License

MIT © Jamen Marz

Readme

Keywords

Package Sidebar

Install

npm i css-truncate-values

Weekly Downloads

1

Version

0.1.4

License

MIT

Last publish

Collaborators

  • npm