@mudbean/is 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,120 @@
1
+ /**
2
+ * # 检测 `input` 是否是 `Intl.Collator` 类型
3
+ *
4
+ * @param input - 待检测的数据,任意类型
5
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Intl.Collator` ,且在 Typescript 中进行类型收缩
6
+ * @example
7
+ *
8
+ * ```ts
9
+ * import { isIntlCollator } from '@mudbean/is';
10
+ *
11
+ * console.log(isIntlCollator(new Intl.Collator())); // true
12
+ *
13
+ * console.log(isIntlCollator(new Intl.DateTimeFormat())); // false
14
+ * ```
15
+ */
16
+ export declare function isIntlCollator(input: any): input is Intl.Collator;
17
+ /**
18
+ * # 检测 `input` 是否是 `Intl.DateTimeFormat` 类型
19
+ *
20
+ * @param input - 待检测的数据,任意类型
21
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Intl.DateTimeFormat` ,且在 Typescript 中进行类型收缩
22
+ *
23
+ * @example
24
+ *
25
+ * ```ts
26
+ * import { isIntlDateTimeFormat } from '@mudbean/is';
27
+ *
28
+ * console.log(isIntlDateTimeFormat(new Intl.DateTimeFormat())); // true
29
+ *
30
+ * console.log(isIntlDateTimeFormat('hello')); // false
31
+ * console.log(isIntlDateTimeFormat(1)); // false
32
+ * console.log(isIntlDateTimeFormat(true)); // false
33
+ * ```
34
+ */
35
+ export declare function isIntlDateTimeFormat(input: any): input is Intl.DateTimeFormat;
36
+ /**
37
+ * # 检测 `input` 是否是 `Intl.DisplayNames` 类型
38
+ *
39
+ * @param input - 待检测的数据,任意类型
40
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Intl.DisplayNames` ,且在 Typescript 中进行类型收缩
41
+ * @example
42
+ *
43
+ * ```ts
44
+ * import { isIntlDisplayNames } from '@mudbean/is';
45
+ *
46
+ * console.log(isIntlDisplayNames(new Intl.DisplayNames())); // true
47
+ *
48
+ * console.log(isIntlDisplayNames(new Intl.Locale())); // false
49
+ * ```
50
+ */
51
+ export declare function isIntlDisplayNames(input: any): input is Intl.DisplayNames;
52
+ /**
53
+ * #检测 `input` 是否是 `Intl.DurationFormat` 类型
54
+ *
55
+ * @param input - 待检测的数据,任意类型
56
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Intl.DurationFormat` ,且在 Typescript 中进行类型收缩
57
+ * @example
58
+ *
59
+ * ```ts
60
+ * import { isIntlDurationFormat } from '@mudbean/is';
61
+ *
62
+ * ```
63
+ *
64
+ */
65
+ /**
66
+ * # 检测 `input` 是否是 `Intl.ListFormat` 类型
67
+ * @param input - 待检测的数据,任意类型
68
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Intl.ListFormat` ,且在 Typescript 中进行类型收缩
69
+ * @example
70
+ *
71
+ * ```ts
72
+ * import { isIntlListFormat } from '@mudbean/is';
73
+ *
74
+ * console.log(isIntlListFormat(new Intl.ListFormat())); // true
75
+ *
76
+ * console.log(isIntlListFormat(new Intl.DateTimeFormat())); // false
77
+ * console.log(isIntlListFormat(1)); // false
78
+ * console.log(isIntlListFormat('1')); // false
79
+ * console.log(isIntlListFormat(null)); // false
80
+ * ```
81
+ */
82
+ export declare function isIntlListFormat(input: any): input is Intl.ListFormat;
83
+ /**
84
+ * # 检测 `input` 是否是 `Intl.Locale` 类型
85
+ *
86
+ * @param input - 待检测的数据,任意类型
87
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Intl.Locale` ,且在 Typescript 中进行类型收缩
88
+ *
89
+ * @example
90
+ *
91
+ * ```ts
92
+ * import { isIntlLocale } from '@mudbean/is';
93
+ *
94
+ * console.log(isIntlLocale(new Intl.Locale())); // true
95
+ *
96
+ * console.log(isIntlLocale('en')); // false
97
+ * console.log(isIntlLocale(1)); // false
98
+ * ```
99
+ */
100
+ export declare function isIntlLocale(input: any): input is Intl.Locale;
101
+ /**
102
+ * # 检测 `input` 是否是 `Intl.NumberFormat` 类型
103
+ *
104
+ * @param input - 待检测的数据,任意类型
105
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Intl.NumberFormat` ,且在 Typescript 中进行类型收缩
106
+ *
107
+ * @example
108
+ *
109
+ * ```ts
110
+ * import { isIntlNumberFormat } from '@mudbean/is';
111
+ *
112
+ * console.log(isIntlNumberFormat(new Intl.NumberFormat())); // true
113
+ *
114
+ * console.log(isIntlNumberFormat(123)); // false
115
+ * console.log(isIntlNumberFormat('123')); // false
116
+ * console.log(isIntlNumberFormat(new Date())); // false
117
+ * console.log(isIntlNumberFormat(new Date(0))); // false
118
+ * ```
119
+ */
120
+ export declare function isIntlNumberFormat(input: any): input is Intl.NumberFormat;
@@ -0,0 +1,281 @@
1
+ /**
2
+ * # 检测 `input` 是否是 `Array` 类型
3
+ *
4
+ * @param input - 待检测的数据,任意类型
5
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `ReferenceError` ,且在 Typescript 中进行类型收缩
6
+ * @example
7
+ *
8
+ * ```ts
9
+ * import { isArray } from '@mudbean/is';
10
+ *
11
+ * console.log(isArray([1,2,3])) // true
12
+ * console.log(isArray({})) // false
13
+ * console.log(isArray(new Set())) // false
14
+ * ```
15
+ */
16
+ export declare function isArray<T = any>(input: any): input is Array<T>;
17
+ /**
18
+ * # 检测 `input` 是否是空数组
19
+ *
20
+ * @param input - 待检测的数据,任意数组
21
+ * @returns 返回 `true` 则说明该数据 `input` 为长度为 0 的空数组 ,且在 Typescript 中进行类型收缩
22
+ * @example
23
+ *
24
+ * ```ts
25
+ * import { isEmptyArray } from '@mudbean/is';
26
+ *
27
+ * console.log(isEmptyArray([])) // true
28
+ *
29
+ * console.log(isEmptyArray([1,2,3])) // false
30
+ * console.log(isEmptyArray({})) // TypeError
31
+ * console.log(isEmptyArray(new Set())) // false
32
+ * ```
33
+ */
34
+ export declare function isEmptyArray(input: any[]): boolean;
35
+ /**
36
+ * # 检测 `input` 是否是 `Set` 类型
37
+ *
38
+ * @param input - 待检测的数据,任意类型
39
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `ReferenceError` ,且在 Typescript 中进行类型收缩
40
+ * @example
41
+ *
42
+ * ```ts
43
+ * import { isSet } from '@mudbean/is';
44
+ *
45
+ * console.log(isSet(new Set())) // true
46
+ * console.log(isSet({})) // false
47
+ * console.log(isSet([])) // false
48
+ * ```
49
+ */
50
+ export declare function isSet<T = any>(input: any): input is Set<T>;
51
+ /**
52
+ * # 检测 `input` 是否是 `WeakSet` 类型
53
+ *
54
+ * @param input - 待检测的数据,任意类型
55
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `WeakSet` ,且在 Typescript 中进行类型收缩
56
+ * @example
57
+ *
58
+ * ```ts
59
+ * import { isWeakSet } from '@mudbean/is';
60
+ *
61
+ * console.log(isWeakSet(new WeakSet())) // true
62
+ *
63
+ * console.log(isWeakSet({})) // false
64
+ * console.log(isWeakSet([])) // false
65
+ * console.log(isWeakSet(1)) // false
66
+ * ```
67
+ */
68
+ export declare function isWeakSet<T extends WeakKey>(input: any): input is WeakSet<T>;
69
+ /**
70
+ * # 检测 `input` 是否是 `Bigint64Array` 类型
71
+ *
72
+ * @param input - 待检测的数据,任意类型
73
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `BigInt64Array` ,且在 Typescript 中进行类型收缩
74
+ * @example
75
+ *
76
+ * ```ts
77
+ * import { isBigInt64Array } from '@mudbean/is';
78
+ *
79
+ * console.log(isBigInt64Array(new BigInt64Array())) // true
80
+ *
81
+ * console.log(isBigInt64Array({})) // false
82
+ * console.log(isBigInt64Array([])) // false
83
+ *
84
+ * ```
85
+ */
86
+ export declare function isBigInt64Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>(input: any): input is BigInt64Array<TArrayBuffer>;
87
+ /**
88
+ * # 检测 `input` 是否是 `BigUint64Array` 类型
89
+ *
90
+ * @param input - 待检测的数据,任意类型
91
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `BigUint64Array` ,且在 Typescript 中进行类型收缩
92
+ * @example
93
+ *
94
+ * ```ts
95
+ * import { isBigUint64Array } from '@mudbean/is';
96
+ *
97
+ * console.log(isBigUint64Array(new BigUint64Array())) // true
98
+ *
99
+ * console.log(isBigUint64Array({})) // false
100
+ * console.log(isBigUint64Array([])) // false
101
+ * console.log(isBigUint64Array(1)) // false
102
+ * ```
103
+ */
104
+ export declare function isBigUint64Array<T extends ArrayBufferLike = ArrayBufferLike>(input: any): input is BigUint64Array<T>;
105
+ /**
106
+ * # 检测 `input` 是否是 `ArrayBuffer` 类型
107
+ *
108
+ * @param input - 待检测的数据,任意类型
109
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `ArrayBuffer` ,且在 Typescript 中进行类型收缩
110
+ * @example
111
+ *
112
+ * ```ts
113
+ * import { isArrayBuffer } from '@mudbean/is';
114
+ *
115
+ * console.log(isArrayBuffer(new ArrayBuffer(8))) // true
116
+ *
117
+ * console.log(isArrayBuffer({})) // false
118
+ * ```
119
+ */
120
+ export declare function isArrayBuffer(input: any): input is ArrayBuffer;
121
+ /**
122
+ * # 检测 `input` 是否是 `int8Array` 类型
123
+ *
124
+ * @param input - 待检测的数据,任意类型
125
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Int8Array` ,且在 Typescript 中进行类型收缩
126
+ * @example
127
+ *
128
+ * ```ts
129
+ * import { isInt8Array } from '@mudbean/is';
130
+ *
131
+ * console.log(isInt8Array(new Int8Array())) // true
132
+ *
133
+ * console.log(isInt8Array({})) // false
134
+ * console.log(isInt8Array([])) // false
135
+ * console.log(isInt8Array(1)) // false
136
+ * ```
137
+ */
138
+ export declare function isInt8Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>(input: any): input is Int8Array<TArrayBuffer>;
139
+ /**
140
+ * # 检测 `input` 是否是 `uint8Array` 类型
141
+ *
142
+ * @param input - 待检测的数据,任意类型
143
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Uint8Array` ,且在 Typescript 中进行类型收缩
144
+ * @example
145
+ *
146
+ * ```ts
147
+ * import { isUint8Array } from '@mudbean/is';
148
+ *
149
+ * console.log(isUint8Array(new Uint8Array())) // true
150
+ *
151
+ * console.log(isUint8Array({})) // false
152
+ * console.log(isUint8Array([])) // false
153
+ * console.log(isUint8Array(1)) // false
154
+ * ```
155
+ */
156
+ export declare function isUint8Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>(input: any): input is Uint8Array<TArrayBuffer>;
157
+ /**
158
+ * # 检测 `input` 是否是 `int16Array` 类型
159
+ *
160
+ * @param input - 待检测的数据,任意类型
161
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Int16Array` ,且在 Typescript 中进行类型收缩
162
+ * @example
163
+ *
164
+ * ```ts
165
+ * import { isInt16Array } from '@mudbean/is';
166
+ *
167
+ * console.log(isInt16Array(new Int16Array())) // true
168
+ *
169
+ * console.log(isInt16Array({})) // false
170
+ * console.log(isInt16Array([])) // false
171
+ * console.log(isInt16Array(1)) // false
172
+ * ```
173
+ */
174
+ export declare function isInt16Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>(input: any): input is Int16Array<TArrayBuffer>;
175
+ /**
176
+ * # 检测 `input` 是否是 `uint16Array` 类型
177
+ *
178
+ * @param input - 待检测的数据,任意类型
179
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Uint16Array` ,且在 Typescript 中进行类型收缩
180
+ * @example
181
+ *
182
+ * ```ts
183
+ *
184
+ * import { isUint16Array } from '@mudbean/is';
185
+ *
186
+ * console.log(isUint16Array(new Uint16Array())) // true
187
+ *
188
+ * console.log(isUint16Array({})) // false
189
+ * console.log(isUint16Array([])) // false
190
+ * console.log(isUint16Array(1)) // false
191
+ * ```
192
+ */
193
+ export declare function isUint16Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>(input: any): input is Uint16Array<TArrayBuffer>;
194
+ /**
195
+ * # 检测 `input` 是否是 `uint32Array` 类型
196
+ *
197
+ * @param input - 待检测的数据,任意类型
198
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Uint32Array` ,且在 Typescript 中进行类型收缩
199
+ * @example
200
+ *
201
+ * ```ts
202
+ * import { isUint32Array } from '@mudbean/is';
203
+ *
204
+ * console.log(isUint32Array(new Uint32Array())) // true
205
+ *
206
+ * console.log(isUint32Array({})) // false
207
+ * console.log(isUint32Array([])) // false
208
+ * console.log(isUint32Array(1)) // false
209
+ * ```
210
+ */
211
+ export declare function isUint32Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>(input: any): input is Uint32Array<TArrayBuffer>;
212
+ /**
213
+ * # 检测 `input` 是否是 `float32Array` 类型
214
+ *
215
+ * @param input - 待检测的数据,任意类型
216
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Float32Array` ,且在 Typescript 中进行类型收缩
217
+ * @example
218
+ *
219
+ * ```ts
220
+ * import { isFloat32Array } from '@mudbean/is';
221
+ *
222
+ * console.log(isFloat32Array(new Float32Array())) // true
223
+ *
224
+ * console.log(isFloat32Array({})) // false
225
+ * console.log(isFloat32Array([])) // false
226
+ * console.log(isFloat32Array(1)) // false
227
+ * ```
228
+ */
229
+ export declare function isFloat32Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>(input: any): input is Float32Array<TArrayBuffer>;
230
+ /**
231
+ * # 检测 `input` 是否是 `float64Array` 类型
232
+ *
233
+ * @param input - 待检测的数据,任意类型
234
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Float64Array` ,且在 Typescript 中进行类型收缩
235
+ * @example
236
+ *
237
+ * ```ts
238
+ * import { isFloat64Array } from '@mudbean/is';
239
+ *
240
+ * console.log(isFloat64Array(new Float64Array())) // true
241
+ *
242
+ * console.log(isFloat64Array({})) // false
243
+ * console.log(isFloat64Array([])) // false
244
+ * console.log(isFloat64Array(1)) // false
245
+ * ```
246
+ */
247
+ export declare function isFloat64Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>(input: any): input is Float64Array<TArrayBuffer>;
248
+ /**
249
+ * # 检测 `input` 是否是 `sharedArrayBuffer` 类型
250
+ *
251
+ * @param input - 待检测的数据,任意类型
252
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `SharedArrayBuffer` ,且在 Typescript 中进行类型收缩
253
+ * @example
254
+ *
255
+ * ```ts
256
+ * import { isSharedArrayBuffer } from '@mudbean/is';
257
+ *
258
+ * console.log(isSharedArrayBuffer(new SharedArrayBuffer(8))) // true
259
+ *
260
+ * console.log(isSharedArrayBuffer({})) // false
261
+ * ```
262
+ */
263
+ export declare function isSharedArrayBuffer(input: any): input is SharedArrayBuffer;
264
+ /**
265
+ * # 检测 `input` 是否是 `uint8ClampedArray` 类型
266
+ *
267
+ * @param input - 待检测的数据,任意类型
268
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Uint8ClampedArray` ,且在 Typescript 中进行类型收缩
269
+ * @example
270
+ *
271
+ * ```ts
272
+ * import { isUint8ClampedArray } from '@mudbean/is';
273
+ *
274
+ * console.log(isUint8ClampedArray(new Uint8ClampedArray())) // true
275
+ *
276
+ * console.log(isUint8ClampedArray({})) // false
277
+ * console.log(isUint8ClampedArray([])) // false
278
+ * console.log(isUint8ClampedArray(1)) // false
279
+ * ```
280
+ */
281
+ export declare function isUint8ClampedArray<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>(input: any): input is Uint8ClampedArray<TArrayBuffer>;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * # 当前数据类型是否为 boolean
3
+ *
4
+ * @param input - 待检测的数据,任意类型
5
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `boolean` ,且在 Typescript 中进行类型收缩
6
+ * @example
7
+ *
8
+ * ```ts
9
+ * import { isBoolean } from '@mudbean/is';
10
+ *
11
+ * console.log(isBoolean(true)); // true
12
+ * console.log(isBoolean(false)); // true
13
+ *
14
+ * console.log(isBoolean(1)); // false
15
+ * console.log(isBoolean('true')); // false
16
+ * ```
17
+ */
18
+ export declare function isBoolean(input: any): input is boolean;
19
+ /**
20
+ * # 当前数据类型是否为真值 true
21
+ *
22
+ * @param input - 待检测的数据,任意类型
23
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `true` ,且在 Typescript 中进行类型收缩
24
+ * @example
25
+ *
26
+ * ```ts
27
+ * import { isTrue } from '@mudbean/is';
28
+ *
29
+ * console.log(isTrue(true)); // true
30
+ *
31
+ * console.log(isTrue(false)); // false
32
+ * console.log(isTrue(1)); // false
33
+ * console.log(isTrue('true')); // false
34
+ * ```
35
+ */
36
+ export declare function isTrue(input: any): input is true;
37
+ /**
38
+ * # 当前数据类型是否为真值 false
39
+ *
40
+ * @param input - 待检测的数据,任意类型
41
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `false` ,且在 Typescript 中进行类型收缩
42
+ * @example
43
+ *
44
+ * ```ts
45
+ * import { isFalse } from '@mudbean/is';
46
+ *
47
+ * console.log(isFalse(false)); // true
48
+ *
49
+ * console.log(isFalse(true)); // false
50
+ * console.log(isFalse(1)); // false
51
+ * console.log(isFalse('true')); // false
52
+ * ```
53
+ */
54
+ export declare function isFalse(input: any): input is false;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * # 检测 `input` 是否是 `function` 类型
3
+ *
4
+ * 函数分类:
5
+ * - 普通函数
6
+ * - 使用 `async` 标注的异步函数
7
+ * - 使用 `*` 标注的生成器函数
8
+ *
9
+ * @param input - 待检测的数据,任意类型
10
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `function` ,且在 Typescript 中进行类型收缩
11
+ * @example
12
+ *
13
+ * ```ts
14
+ * import { isFunction } from '@mudbean/is';
15
+ *
16
+ * console.log(isFunction(() => {})); // true
17
+ *
18
+ * console.log(isFunction(async () => {})); // false
19
+ * console.log(isFunction(function* () {})); // false
20
+ * ```
21
+ */
22
+ export declare function isFunction<T extends (...args: any[]) => void>(input: any): input is T;
23
+ /**
24
+ * # 检测 `input` 是否是 `Promise` 类型
25
+ *
26
+ * @param input - 待检测的数据,任意类型
27
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Promise` ,且在 Typescript 中进行类型收缩
28
+ * @example
29
+ *
30
+ * ```ts
31
+ * import { isPromise } from '@mudbean/is';
32
+ *
33
+ * console.log(isPromise(new Promise(() => {}))); // true
34
+ * console.log(isPromise(() => {})); // false
35
+ * ```
36
+ */
37
+ export declare function isPromise<T>(input: any): input is Promise<T>;
38
+ /**
39
+ * # 检测 `input` 是否是 `AsyncFunction` 类型
40
+ *
41
+ * @param input - 待检测的数据,任意类型
42
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `async function` ,且在 Typescript 中进行类型收缩
43
+ * @example
44
+ *
45
+ * ```ts
46
+ * import { isAsyncFunction } from '@mudbean/is';
47
+ *
48
+ * console.log(isAsyncFunction(async () => {})); // true
49
+ * console.log(isAsyncFunction(() => {})); // false
50
+ * ```
51
+ */
52
+ export declare function isAsyncFunction<T extends (...args: any[]) => void>(input: any): input is () => Promise<T>;
53
+ /**
54
+ * # 检测 `input` 是否是 `GeneratorFunction` 类型
55
+ *
56
+ * @param input - 待检测的数据,任意类型
57
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `generator function` ,且在 Typescript 中进行类型收缩
58
+ * @example
59
+ *
60
+ * ```ts
61
+ * import { isGeneratorFunction } from '@mudbean/is';
62
+ *
63
+ * console.log(isGeneratorFunction(function* () {})); // true
64
+ * console.log(isGeneratorFunction(() => {})); // false
65
+ * ```
66
+ *
67
+ */
68
+ export declare function isGeneratorFunction(input: any): input is GeneratorFunction;
69
+ /**
70
+ * # 检测 `input` 是否是 `Generator` 类型
71
+ *
72
+ * @param input - 待检测的数据,任意类型
73
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `Generator` ,且在 Typescript 中进行类型收缩
74
+ * @example
75
+ *
76
+ * ```ts
77
+ * import { isGenerator } from '@mudbean/is';
78
+ *
79
+ * const log = (str) => console.log(str);
80
+ * const foo = function* () {
81
+ * yield "a";
82
+ * yield "b";
83
+ * yield "c";
84
+ * }
85
+ *
86
+ * const gen = foo();
87
+ *
88
+ * log(gen.next().value); // a
89
+ * log(gen.next().value); // b
90
+ * log(gen.next().value); // c
91
+ *
92
+ * console.log(isGenerator(foo)); // false
93
+ * console.log(isGenerator(gen)); // true
94
+ *
95
+ * ```
96
+ */
97
+ export declare function isGenerator(input: any): input is Generator;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * 检测 Javascript 数据类型工具之: null
3
+ */
4
+ /**
5
+ *
6
+ * 检测 `input` 是否是 `null` 类型
7
+ *
8
+ * @param input - 待检测的数据,任意类型
9
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `null` ,且在 Typescript 中进行类型收缩
10
+ * @example
11
+ *
12
+ * ```ts
13
+ * import { isNull } from '@mudbean/is';
14
+ *
15
+ * console.log(isNull(null)); // true
16
+ *
17
+ * console.log(isNull(undefined)); // false
18
+ * console.log(isNull(1)); // false
19
+ * ```
20
+ */
21
+ export declare function isNull(input: any): input is null;
22
+ /**
23
+ *
24
+ * 检测 `input` 是否是 `undefined` 类型
25
+ *
26
+ * @param input - 待检测的数据,任意类型
27
+ * @returns 返回 `true` 则说明该数据 `input` 类型为 `undefined` ,且在 Typescript 中进行类型收缩
28
+ * @example
29
+ *
30
+ * ```ts
31
+ * import { isUndefined } from '@mudbean/is';
32
+ *
33
+ * console.log(isUndefined(undefined)); // true
34
+ *
35
+ * console.log(isUndefined(null)); // false
36
+ * console.log(isUndefined(1)); // false
37
+ * ```
38
+ *
39
+ */
40
+ export declare function isUndefined(input: any): input is undefined;