Skip to content

isNullish

判断一个值是否为 null 或 undefined

53 bytes
since v12.3.0

用法

传入一个值,将返回一个布尔值,告诉你该值是否为 null 或 undefined。

import * as _ from 'radashi'
_.isNullish(null) // => true
_.isNullish(undefined) // => true
_.isNullish('') // => false
_.isNullish([]) // => false
_.isNullish(0) // => false