Skip to content

toInt

尽可能将给定值转换为整型

157 bytes
since v12.1.0

用法说明

_.toInt 函数会尽可能尝试将给定值转换为整型。

import * as _ from 'radashi'
_.toInt(0) // => 0
_.toInt(null) // => 0
_.toInt(null, 3) // => 3