Appearance
isNullOrUndefined 判断空值
function isNullOrUndefined(value: unknown): value is null | undefined
判断传入值是否为 null 或 undefined。
参数
| 参数名 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| value | 待判断的值 | unknown | 必填 |
返回值
| 返回值 | 说明 | 类型 |
|---|---|---|
| result | 值为 null 或 undefined 时返回 true,否则返回 false | boolean |
示例
typescript
import { isNullOrUndefined } from '@mingto/tools'
isNullOrUndefined(null) // true
isNullOrUndefined(undefined) // true
isNullOrUndefined(0) // false