to-safe-integer-x
v1.2.2
Published
ToSafeInteger converts 'argument' to an integral numeric value of safe limit.
Downloads
18
Maintainers
Readme
to-safe-integer-x
Constructs and returns a new string which contains the specified number of copies of the string.
module.exports
⇒ * ⏏
Converts value
to a safe integer.
Kind: static property of to-safe-integer-x
Returns: number - Returns the converted integer.
| Param | Type | Description | | ----- | --------------- | --------------------- | | value | * | The value to convert. |
Example
import {toSafeInteger} from 'to-safe-integer-x';
console.log(toSafeInteger(3)); // 3
console.log(toSafeInteger(Number.MIN_VALUE)); // 0
console.log(toSafeInteger(Infinity)); // 9007199254740991
console.log(toSafeInteger(-Infinity)); // -9007199254740991
console.log(toSafeInteger('3')); // 3