Skip to content
This repository was archived by the owner on Sep 24, 2021. It is now read-only.

jamen/css-truncate-values

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Truncate CSS numbers while retaining the original value.

Resources

License

Stars

Watchers

Forks

Packages

No packages published