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