0.0.2 • Published 7 years ago

tointeger v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

tointeger Build Status Coverage Status npm version

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

License

MIT