tointeger

0.0.2 • Public • Published

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

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i tointeger

    Weekly Downloads

    3

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • yefremov