Licence
MIT
Version
1.2.2
Deps
2
Size
236 kB
Vulns
0
Weekly
0
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