Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

get-integer

1.0.0 • Public • Published

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

Install

npm i get-integer

DownloadsWeekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • avatar