parse-int
v1.0.3
Published
Strict integer parsing
Downloads
122,461
Maintainers
Readme
parse-int
Strict integer parsing. If it's not an actual integer or an integer string, return undefined.
Install
$ npm install --save parse-int
Usage
var parseInt = require('parse-int');
parseInt(2) // 2
parseInt('2') // 2
parseInt('2.2') // undefined
parseInt(1.2) // undefined
parseInt('2a') // undefined
parseInt() // undefined
API
parseInt(number)
-> number
/ undefined
number
Required
Type: any
The number to attempt to parse.
License
MIT © Ben Drucker