tointeger
v0.0.2
Published
Convert value to an integer value
Downloads
16
Maintainers
Readme
tointeger
Convert value to an integer value.
Please note that this is not an ecma262 "tointeger" implementation,
but just a safer version of what you usually want from parseInt()
to a value to integer value.
Installation
$ npm install tointeger
API
import toInteger from 'tointeger';
toInteger(1.9);
// => 1
toInteger('5.5');
// => 5
toInteger(NaN);
// => 0
toInteger(Infinity);
// => 0
Running tests
$ npm test