1.0.0 • Published 7 years ago

get-integer v1.0.0

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

Synopsis

Easy lib for converting variables to integer. For cases, when module can not convert data type, it will return 0.

Code Example

const getInteger = require('get-integer');

const stringToInt = getInteger('123');
console.log(stringToInt); // 123

const floatToInt = getInteger(1.23);
console.log(floatToInt); // 1

const NaNToInt = getInteger('string');
console.log(NaNToInt); // 0

Installation

via npm:

npm install get-integer

or you can clone github repository:

git clone https://github.com/antishov/get-integer

Tests

./node_modules/.bin/_mocha ./test -R spec

or simple npm test

License

MIT License