4.17.11
3.10.1
2.4.2
1.3.1

_.toSafeInteger(value)

Converts value to a safe integer. A safe integer can be compared and represented correctly.

Since

4.0.0

Arguments

argument
value
type
*
description
The value to convert.

Returns

(array)

Example

_.toSafeInteger(3.2);
// => 3

_.toSafeInteger(Number.MIN_VALUE);
// => 0

_.toSafeInteger(Infinity);
// => 9007199254740991

_.toSafeInteger("3.2");
// => 3
_.toSafeInteger(3.2);
// => 3

_.toSafeInteger(Number.MIN_VALUE);
// => 0

_.toSafeInteger(Infinity);
// => 9007199254740991

_.toSafeInteger("3.2");
// => 3