to-integer
Converts the given value to an integer.
Install
$ npm install --save to-integer
Usage
For more use-cases see the tests
var toInteger = ; ; // => 1; // => 0; // => 0; // => Number.MAX_VALUE; // => Infinity // boolean; // => 1; // => 0 // string; // => 1; // => 0; // => -1; // => 1; // => -1; // => 1; // => 0; // => 1; // => NaN // binary; // => 1; // => 2; // => 3; // => NaN // octal; // => 1 ; // => 7; // => 8; // => NaN // hex; // => 1 ; // => 15 ; // => NaN; // => NaN; // => NaN // object; // => 1; // => 1; // => 1; // => NaN ; // => NaN
Related
- to-num - Converts the given value to a number.
- to-str - Converts the given value to a string.
- to-length - Converts value to an integer suitable for use as the length of an array-like object.
- to-lower - Converts string, as a whole, to lower case.
- to-upper - Converts string, as a whole, to upper case.
- to-path - Converts value to a property path array.
- to-source-code - Converts function to its source code.
Contributing
Pull requests and stars are highly welcome.
For bugs and feature requests, please create an issue.