isNull

说明

判断是否为严格的null

源码

用法

isNull.test.ts
1
import { isNull } from "util";
2
3
4
describe('isNull', () => {
5
test('isNull should return `false` if received a non null value', () => {
6
const received = [
7
0,
8
'',
9
undefined,
10
{},
11
[],
12
function () { },
13
];
14
15
for (const v of received) {
16
expect(isNull(v)).toBeFalsy();
17
}
18
});
19
20
test('isNull should return `true` if received a null value', () => {
21
const received = [
22
null,
23
];
24
25
for (const v of received) {
26
expect(isNull(v)).toBeTruthy();
27
}
28
});
29
});
Copied!
最近更新 1yr ago
复制链接