Lodash _.toSafeInteger

2021-09-22 14:05 更新

_.toSafeInteger(value) 

转换 value 为安全整数。 安全整数可以用于比较和准确的表示。

添加版本

4.0.0

参数

  1. value (*): 要转换的值。

返回

(number): 返回转换后的整数。

例子

_.toSafeInteger(3.2);
// => 3 
_.toSafeInteger(Number.MIN_VALUE);
// => 0 
_.toSafeInteger(Infinity);
// => 9007199254740991 
_.toSafeInteger('3.2');
// => 3


以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号