_.toSafeInteger(强转为安全整数)
语法:
_.toSafeInteger(value)
源代码链接:source
npm包链接:npm package
描述:
转换value
为安全整数。 安全整数可以用于比较和准确的表示。
开始版本:4.0.0
参数:
value (*)
: 要转换的值。
返回值:
(number)
: 返回转换后的整数。
例子:
_.toSafeInteger(3.2);
// => 3
_.toSafeInteger(Number.MIN_VALUE);
// => 0
_.toSafeInteger(Infinity);
// => 9007199254740991
_.toSafeInteger('3.2');
// => 3
Last updated
Was this helpful?