is-what 4.1.15 → 4.1.16
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.
- package/dist/cjs/index.cjs +114 -78
- package/dist/cjs/index.d.cts +248 -202
- package/dist/index.d.ts +248 -202
- package/dist/index.js +114 -78
- package/package.json +13 -21
package/dist/cjs/index.d.cts
CHANGED
@@ -1,334 +1,380 @@
|
|
1
|
-
type AnyFunction = (...args: any[]) => any;
|
2
|
-
type AnyAsyncFunction = (...args: any[]) => Promise<any>;
|
3
|
-
type AnyClass = new (...args: any[]) => any;
|
4
|
-
type PlainObject = Record<string | number | symbol, any>;
|
5
|
-
type TypeGuard<A, B extends A> = (payload: A) => payload is B;
|
6
1
|
/**
|
7
2
|
* Returns the object type of the given payload
|
8
3
|
*
|
9
|
-
* @param {
|
4
|
+
* @param {any} payload
|
10
5
|
* @returns {string}
|
11
6
|
*/
|
12
7
|
declare function getType(payload: any): string;
|
8
|
+
|
9
|
+
type PlainObject = Record<string | number | symbol, any>;
|
13
10
|
/**
|
14
|
-
* Returns whether the payload is
|
11
|
+
* Returns whether the payload is a plain JavaScript object (excluding special classes or objects
|
12
|
+
* with other prototypes)
|
15
13
|
*
|
16
|
-
* @param {
|
17
|
-
* @returns {payload is
|
14
|
+
* @param {any} payload
|
15
|
+
* @returns {payload is PlainObject}
|
18
16
|
*/
|
19
|
-
declare function
|
17
|
+
declare function isPlainObject(payload: any): payload is PlainObject;
|
18
|
+
|
20
19
|
/**
|
21
|
-
* Returns whether the payload is
|
20
|
+
* Returns whether the payload is an any kind of object (including special classes or objects with
|
21
|
+
* different prototypes)
|
22
22
|
*
|
23
|
-
* @param {
|
24
|
-
* @returns {payload is
|
23
|
+
* @param {any} payload
|
24
|
+
* @returns {payload is PlainObject}
|
25
25
|
*/
|
26
|
-
declare function
|
26
|
+
declare function isAnyObject(payload: any): payload is PlainObject;
|
27
|
+
|
27
28
|
/**
|
28
|
-
* Returns whether the payload is
|
29
|
+
* Returns whether the payload is an array
|
29
30
|
*
|
30
|
-
* @param {
|
31
|
-
* @returns {payload is
|
31
|
+
* @param {any} payload
|
32
|
+
* @returns {payload is any[]}
|
32
33
|
*/
|
33
|
-
declare function
|
34
|
+
declare function isArray(payload: any): payload is any[];
|
35
|
+
|
34
36
|
/**
|
35
|
-
* Returns whether the payload is a
|
37
|
+
* Returns whether the payload is a Blob
|
36
38
|
*
|
37
|
-
* @param {
|
38
|
-
* @returns {payload is
|
39
|
+
* @param {any} payload
|
40
|
+
* @returns {payload is Blob}
|
39
41
|
*/
|
40
|
-
declare function
|
42
|
+
declare function isBlob(payload: any): payload is Blob;
|
43
|
+
|
41
44
|
/**
|
42
|
-
* Returns whether the payload is a
|
45
|
+
* Returns whether the payload is a boolean
|
43
46
|
*
|
44
|
-
* @param {
|
45
|
-
* @returns {payload is
|
47
|
+
* @param {any} payload
|
48
|
+
* @returns {payload is boolean}
|
46
49
|
*/
|
47
|
-
declare function
|
48
|
-
|
49
|
-
};
|
50
|
+
declare function isBoolean(payload: any): payload is boolean;
|
51
|
+
|
50
52
|
/**
|
51
|
-
* Returns whether the payload is a
|
53
|
+
* Returns whether the payload is a Date, and that the date is valid
|
52
54
|
*
|
53
|
-
* @param {
|
54
|
-
* @returns {payload is
|
55
|
+
* @param {any} payload
|
56
|
+
* @returns {payload is Date}
|
55
57
|
*/
|
56
|
-
declare function
|
58
|
+
declare function isDate(payload: any): payload is Date;
|
59
|
+
|
57
60
|
/**
|
58
|
-
* Returns whether the payload is an
|
61
|
+
* Returns whether the payload is a an empty array
|
59
62
|
*
|
60
|
-
* @param {
|
61
|
-
* @returns {payload is
|
63
|
+
* @param {any} payload
|
64
|
+
* @returns {payload is []}
|
62
65
|
*/
|
63
|
-
declare function
|
66
|
+
declare function isEmptyArray(payload: any): payload is [];
|
67
|
+
|
64
68
|
/**
|
65
|
-
* Returns whether the payload is an object
|
69
|
+
* Returns whether the payload is a an empty object (excluding special classes or objects with other
|
70
|
+
* prototypes)
|
66
71
|
*
|
67
|
-
*
|
72
|
+
* @param {any} payload
|
73
|
+
* @returns {payload is { [K in any]: never }}
|
74
|
+
*/
|
75
|
+
declare function isEmptyObject(payload: any): payload is {
|
76
|
+
[K in any]: never;
|
77
|
+
};
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Returns whether the payload is ''
|
68
81
|
*
|
69
|
-
* @
|
70
|
-
* @
|
71
|
-
* @returns {payload is T}
|
82
|
+
* @param {any} payload
|
83
|
+
* @returns {payload is string}
|
72
84
|
*/
|
73
|
-
declare function
|
85
|
+
declare function isEmptyString(payload: any): payload is string;
|
86
|
+
|
74
87
|
/**
|
75
|
-
* Returns whether the payload is
|
88
|
+
* Returns whether the payload is an Error
|
76
89
|
*
|
77
|
-
* @param {
|
78
|
-
* @returns {payload is
|
90
|
+
* @param {any} payload
|
91
|
+
* @returns {payload is Error}
|
79
92
|
*/
|
80
|
-
declare function
|
93
|
+
declare function isError(payload: any): payload is Error;
|
94
|
+
|
81
95
|
/**
|
82
|
-
* Returns whether the payload is
|
96
|
+
* Returns whether the payload is a File
|
83
97
|
*
|
84
98
|
* @param {any} payload
|
85
|
-
* @returns {payload is
|
99
|
+
* @returns {payload is File}
|
86
100
|
*/
|
87
|
-
declare function
|
101
|
+
declare function isFile(payload: any): payload is File;
|
102
|
+
|
88
103
|
/**
|
89
104
|
* Returns whether the payload is a an array with at least 1 item
|
90
105
|
*
|
91
|
-
* @param {
|
106
|
+
* @param {any} payload
|
92
107
|
* @returns {payload is any[]}
|
93
108
|
*/
|
94
109
|
declare function isFullArray(payload: any): payload is any[];
|
110
|
+
|
95
111
|
/**
|
96
|
-
* Returns whether the payload is a an empty
|
112
|
+
* Returns whether the payload is a an empty object (excluding special classes or objects with other
|
113
|
+
* prototypes)
|
97
114
|
*
|
98
|
-
* @param {
|
99
|
-
* @returns {payload is
|
115
|
+
* @param {any} payload
|
116
|
+
* @returns {payload is PlainObject}
|
100
117
|
*/
|
101
|
-
declare function
|
118
|
+
declare function isFullObject(payload: any): payload is PlainObject;
|
119
|
+
|
102
120
|
/**
|
103
|
-
* Returns whether the payload is a string
|
121
|
+
* Returns whether the payload is a string, BUT returns false for ''
|
104
122
|
*
|
105
|
-
* @param {
|
123
|
+
* @param {any} payload
|
106
124
|
* @returns {payload is string}
|
107
125
|
*/
|
108
|
-
declare function
|
126
|
+
declare function isFullString(payload: any): payload is string;
|
127
|
+
|
128
|
+
type AnyFunction = (...args: any[]) => any;
|
109
129
|
/**
|
110
|
-
* Returns whether the payload is a
|
130
|
+
* Returns whether the payload is a function (regular or async)
|
111
131
|
*
|
112
|
-
* @param {
|
113
|
-
* @returns {payload is
|
132
|
+
* @param {any} payload
|
133
|
+
* @returns {payload is AnyFunction}
|
114
134
|
*/
|
115
|
-
declare function
|
135
|
+
declare function isFunction(payload: any): payload is AnyFunction;
|
136
|
+
|
137
|
+
type AnyClass = new (...args: any[]) => any;
|
116
138
|
/**
|
117
|
-
*
|
139
|
+
* Does a generic check to check that the given payload is of a given type. In cases like Number, it
|
140
|
+
* will return true for NaN as NaN is a Number (thanks javascript!); It will, however, differentiate
|
141
|
+
* between object and null
|
118
142
|
*
|
119
|
-
* @
|
120
|
-
* @
|
143
|
+
* @template T
|
144
|
+
* @param {any} payload
|
145
|
+
* @param {T} type
|
146
|
+
* @returns {payload is T}
|
147
|
+
* @throws {TypeError} Will throw type error if type is an invalid type
|
121
148
|
*/
|
122
|
-
declare function
|
149
|
+
declare function isType<T extends AnyFunction | AnyClass>(payload: any, type: T): payload is T;
|
150
|
+
|
151
|
+
type GlobalClassName = {
|
152
|
+
[K in keyof typeof globalThis]: (typeof globalThis)[K] extends AnyClass ? K : never;
|
153
|
+
}[keyof typeof globalThis];
|
123
154
|
/**
|
124
|
-
*
|
155
|
+
* Checks if a value is an instance of a class or a class name. Useful when you want to check if a
|
156
|
+
* value is an instance of a class that may not be defined in the current scope. For example, if you
|
157
|
+
* want to check if a value is an `OffscreenCanvas` instance, you might not want to do the song and
|
158
|
+
* dance of using `typeof OffscreenCanvas !== 'undefined'` and then shimming `OffscreenCanvas` if
|
159
|
+
* the types aren't around.
|
125
160
|
*
|
126
|
-
*
|
161
|
+
* @example
|
162
|
+
* if (isInstanceOf(value, 'OffscreenCanvas')) {
|
163
|
+
* // value is an OffscreenCanvas
|
164
|
+
* }
|
127
165
|
*
|
128
|
-
* @param
|
129
|
-
* @
|
166
|
+
* @param value The value to recursively check
|
167
|
+
* @param class_ A string or class that the value should be an instance of
|
130
168
|
*/
|
131
|
-
declare function
|
169
|
+
declare function isInstanceOf<T extends AnyClass>(value: unknown, class_: T): value is T;
|
170
|
+
declare function isInstanceOf<K extends GlobalClassName>(value: unknown, className: K): value is (typeof globalThis)[K];
|
171
|
+
declare function isInstanceOf(value: unknown, className: string): value is object;
|
172
|
+
|
132
173
|
/**
|
133
|
-
* Returns whether the payload is a
|
174
|
+
* Returns whether the payload is a Map
|
134
175
|
*
|
135
|
-
* @param {
|
136
|
-
* @returns {payload is
|
176
|
+
* @param {any} payload
|
177
|
+
* @returns {payload is Map<any, any>}
|
137
178
|
*/
|
138
|
-
declare function
|
179
|
+
declare function isMap(payload: any): payload is Map<any, any>;
|
180
|
+
|
181
|
+
/**
|
182
|
+
* Returns whether the payload is literally the value `NaN` (it's `NaN` and also a `number`)
|
183
|
+
*
|
184
|
+
* @param {any} payload
|
185
|
+
* @returns {payload is typeof NaN}
|
186
|
+
*/
|
187
|
+
declare function isNaNValue(payload: any): payload is typeof NaN;
|
188
|
+
|
139
189
|
/**
|
140
190
|
* Returns whether the payload is a negative number (but not 0)
|
141
191
|
*
|
142
|
-
* @param {
|
192
|
+
* @param {any} payload
|
143
193
|
* @returns {payload is number}
|
144
194
|
*/
|
145
195
|
declare function isNegativeNumber(payload: any): payload is number;
|
196
|
+
|
146
197
|
/**
|
147
|
-
* Returns whether the payload is
|
198
|
+
* Returns whether the payload is null
|
148
199
|
*
|
149
|
-
* @param {
|
150
|
-
* @returns {payload is
|
200
|
+
* @param {any} payload
|
201
|
+
* @returns {payload is null}
|
151
202
|
*/
|
152
|
-
declare function
|
203
|
+
declare function isNull(payload: any): payload is null;
|
204
|
+
|
153
205
|
/**
|
154
|
-
* Returns whether the payload is
|
206
|
+
* Returns true whether the payload is null or undefined
|
155
207
|
*
|
156
|
-
* @param {
|
157
|
-
* @returns {payload is
|
208
|
+
* @param {any} payload
|
209
|
+
* @returns {(payload is null | undefined)}
|
158
210
|
*/
|
159
|
-
declare
|
211
|
+
declare const isNullOrUndefined: (payload: any) => payload is null | undefined;
|
212
|
+
|
160
213
|
/**
|
161
|
-
* Returns whether the payload is a
|
214
|
+
* Returns whether the payload is a number (but not NaN)
|
162
215
|
*
|
163
|
-
*
|
164
|
-
* @returns {payload is Map<any, any>}
|
165
|
-
*/
|
166
|
-
declare function isMap(payload: any): payload is Map<any, any>;
|
167
|
-
/**
|
168
|
-
* Returns whether the payload is a WeakMap
|
216
|
+
* This will return `false` for `NaN`!!
|
169
217
|
*
|
170
|
-
* @param {
|
171
|
-
* @returns {payload is
|
218
|
+
* @param {any} payload
|
219
|
+
* @returns {payload is number}
|
172
220
|
*/
|
173
|
-
declare function
|
221
|
+
declare function isNumber(payload: any): payload is number;
|
222
|
+
|
174
223
|
/**
|
175
|
-
* Returns whether the payload is a
|
224
|
+
* Returns whether the payload is a plain JavaScript object (excluding special classes or objects
|
225
|
+
* with other prototypes)
|
176
226
|
*
|
177
|
-
* @param {
|
178
|
-
* @returns {payload is
|
227
|
+
* @param {any} payload
|
228
|
+
* @returns {payload is PlainObject}
|
179
229
|
*/
|
180
|
-
declare function
|
230
|
+
declare function isObject(payload: any): payload is PlainObject;
|
231
|
+
|
181
232
|
/**
|
182
|
-
* Returns whether the payload is a
|
233
|
+
* Returns whether the payload is an object like a type passed in < >
|
183
234
|
*
|
184
|
-
*
|
185
|
-
* @returns {payload is WeakSet<any>}
|
186
|
-
*/
|
187
|
-
declare function isWeakSet(payload: any): payload is WeakSet<any>;
|
188
|
-
/**
|
189
|
-
* Returns whether the payload is a Symbol
|
235
|
+
* Usage: isObjectLike<{id: any}>(payload) // will make sure it's an object and has an `id` prop.
|
190
236
|
*
|
191
|
-
* @
|
192
|
-
* @
|
237
|
+
* @template T This must be passed in < >
|
238
|
+
* @param {any} payload
|
239
|
+
* @returns {payload is T}
|
193
240
|
*/
|
194
|
-
declare function
|
241
|
+
declare function isObjectLike<T extends PlainObject>(payload: any): payload is T;
|
242
|
+
|
243
|
+
type TypeGuard<A, B extends A> = (payload: A) => payload is B;
|
195
244
|
/**
|
196
|
-
*
|
245
|
+
* A factory function that creates a function to check if the payload is one of the given types.
|
197
246
|
*
|
198
|
-
* @
|
199
|
-
*
|
200
|
-
*/
|
201
|
-
declare function isDate(payload: any): payload is Date;
|
202
|
-
/**
|
203
|
-
* Returns whether the payload is a Blob
|
247
|
+
* @example
|
248
|
+
* import { isOneOf, isNull, isUndefined } from 'is-what'
|
204
249
|
*
|
205
|
-
*
|
206
|
-
*
|
250
|
+
* const isNullOrUndefined = isOneOf(isNull, isUndefined)
|
251
|
+
*
|
252
|
+
* isNullOrUndefined(null) // true
|
253
|
+
* isNullOrUndefined(undefined) // true
|
254
|
+
* isNullOrUndefined(123) // false
|
207
255
|
*/
|
208
|
-
declare function
|
256
|
+
declare function isOneOf<A, B extends A, C extends A>(a: TypeGuard<A, B>, b: TypeGuard<A, C>): TypeGuard<A, B | C>;
|
209
257
|
/**
|
210
|
-
*
|
258
|
+
* A factory function that creates a function to check if the payload is one of the given types.
|
211
259
|
*
|
212
|
-
* @
|
213
|
-
*
|
260
|
+
* @example
|
261
|
+
* import { isOneOf, isNull, isUndefined } from 'is-what'
|
262
|
+
*
|
263
|
+
* const isNullOrUndefined = isOneOf(isNull, isUndefined)
|
264
|
+
*
|
265
|
+
* isNullOrUndefined(null) // true
|
266
|
+
* isNullOrUndefined(undefined) // true
|
267
|
+
* isNullOrUndefined(123) // false
|
214
268
|
*/
|
215
|
-
declare function
|
269
|
+
declare function isOneOf<A, B extends A, C extends A, D extends A>(a: TypeGuard<A, B>, b: TypeGuard<A, C>, c: TypeGuard<A, D>): TypeGuard<A, B | C | D>;
|
216
270
|
/**
|
217
|
-
*
|
271
|
+
* A factory function that creates a function to check if the payload is one of the given types.
|
218
272
|
*
|
219
|
-
* @
|
220
|
-
*
|
273
|
+
* @example
|
274
|
+
* import { isOneOf, isNull, isUndefined } from 'is-what'
|
275
|
+
*
|
276
|
+
* const isNullOrUndefined = isOneOf(isNull, isUndefined)
|
277
|
+
*
|
278
|
+
* isNullOrUndefined(null) // true
|
279
|
+
* isNullOrUndefined(undefined) // true
|
280
|
+
* isNullOrUndefined(123) // false
|
221
281
|
*/
|
222
|
-
declare function
|
282
|
+
declare function isOneOf<A, B extends A, C extends A, D extends A, E extends A>(a: TypeGuard<A, B>, b: TypeGuard<A, C>, c: TypeGuard<A, D>, d: TypeGuard<A, E>): TypeGuard<A, B | C | D | E>;
|
223
283
|
/**
|
224
|
-
*
|
284
|
+
* A factory function that creates a function to check if the payload is one of the given types.
|
225
285
|
*
|
226
|
-
* @
|
227
|
-
*
|
286
|
+
* @example
|
287
|
+
* import { isOneOf, isNull, isUndefined } from 'is-what'
|
288
|
+
*
|
289
|
+
* const isNullOrUndefined = isOneOf(isNull, isUndefined)
|
290
|
+
*
|
291
|
+
* isNullOrUndefined(null) // true
|
292
|
+
* isNullOrUndefined(undefined) // true
|
293
|
+
* isNullOrUndefined(123) // false
|
228
294
|
*/
|
229
|
-
declare function
|
295
|
+
declare function isOneOf<A, B extends A, C extends A, D extends A, E extends A, F extends A>(a: TypeGuard<A, B>, b: TypeGuard<A, C>, c: TypeGuard<A, D>, d: TypeGuard<A, E>, e: TypeGuard<A, F>): TypeGuard<A, B | C | D | E | F>;
|
296
|
+
|
230
297
|
/**
|
231
|
-
* Returns whether the payload is
|
298
|
+
* Returns whether the payload is a positive number (but not 0)
|
232
299
|
*
|
233
|
-
* @param {
|
234
|
-
* @returns {payload is
|
300
|
+
* @param {any} payload
|
301
|
+
* @returns {payload is number}
|
235
302
|
*/
|
236
|
-
declare function
|
303
|
+
declare function isPositiveNumber(payload: any): payload is number;
|
304
|
+
|
237
305
|
/**
|
238
|
-
* Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String
|
306
|
+
* Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String
|
307
|
+
* | Symbol)
|
239
308
|
*
|
240
|
-
* @param {
|
309
|
+
* @param {any} payload
|
241
310
|
* @returns {(payload is boolean | null | undefined | number | string | symbol)}
|
242
311
|
*/
|
243
312
|
declare function isPrimitive(payload: any): payload is boolean | null | undefined | number | string | symbol;
|
313
|
+
|
244
314
|
/**
|
245
|
-
* Returns
|
315
|
+
* Returns whether the payload is a Promise
|
246
316
|
*
|
247
|
-
* @param {
|
248
|
-
* @returns {
|
317
|
+
* @param {any} payload
|
318
|
+
* @returns {payload is Promise<any>}
|
249
319
|
*/
|
250
|
-
declare
|
320
|
+
declare function isPromise(payload: any): payload is Promise<any>;
|
321
|
+
|
251
322
|
/**
|
252
|
-
*
|
253
|
-
* @example
|
254
|
-
* import { isOneOf, isNull, isUndefined } from 'is-what'
|
255
|
-
*
|
256
|
-
* const isNullOrUndefined = isOneOf(isNull, isUndefined)
|
323
|
+
* Returns whether the payload is a regular expression (RegExp)
|
257
324
|
*
|
258
|
-
*
|
259
|
-
*
|
260
|
-
* isNullOrUndefined(123) // false
|
325
|
+
* @param {any} payload
|
326
|
+
* @returns {payload is RegExp}
|
261
327
|
*/
|
262
|
-
declare function
|
328
|
+
declare function isRegExp(payload: any): payload is RegExp;
|
329
|
+
|
263
330
|
/**
|
264
|
-
*
|
265
|
-
* @example
|
266
|
-
* import { isOneOf, isNull, isUndefined } from 'is-what'
|
267
|
-
*
|
268
|
-
* const isNullOrUndefined = isOneOf(isNull, isUndefined)
|
331
|
+
* Returns whether the payload is a Set
|
269
332
|
*
|
270
|
-
*
|
271
|
-
*
|
272
|
-
* isNullOrUndefined(123) // false
|
333
|
+
* @param {any} payload
|
334
|
+
* @returns {payload is Set<any>}
|
273
335
|
*/
|
274
|
-
declare function
|
336
|
+
declare function isSet(payload: any): payload is Set<any>;
|
337
|
+
|
275
338
|
/**
|
276
|
-
*
|
277
|
-
* @example
|
278
|
-
* import { isOneOf, isNull, isUndefined } from 'is-what'
|
279
|
-
*
|
280
|
-
* const isNullOrUndefined = isOneOf(isNull, isUndefined)
|
339
|
+
* Returns whether the payload is a string
|
281
340
|
*
|
282
|
-
*
|
283
|
-
*
|
284
|
-
* isNullOrUndefined(123) // false
|
341
|
+
* @param {any} payload
|
342
|
+
* @returns {payload is string}
|
285
343
|
*/
|
286
|
-
declare function
|
344
|
+
declare function isString(payload: any): payload is string;
|
345
|
+
|
287
346
|
/**
|
288
|
-
*
|
289
|
-
* @example
|
290
|
-
* import { isOneOf, isNull, isUndefined } from 'is-what'
|
291
|
-
*
|
292
|
-
* const isNullOrUndefined = isOneOf(isNull, isUndefined)
|
347
|
+
* Returns whether the payload is a Symbol
|
293
348
|
*
|
294
|
-
*
|
295
|
-
*
|
296
|
-
* isNullOrUndefined(123) // false
|
349
|
+
* @param {any} payload
|
350
|
+
* @returns {payload is symbol}
|
297
351
|
*/
|
298
|
-
declare function
|
352
|
+
declare function isSymbol(payload: any): payload is symbol;
|
353
|
+
|
299
354
|
/**
|
300
|
-
*
|
301
|
-
* In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!);
|
302
|
-
* It will, however, differentiate between object and null
|
355
|
+
* Returns whether the payload is undefined
|
303
356
|
*
|
304
|
-
* @
|
305
|
-
* @
|
306
|
-
* @param {T} type
|
307
|
-
* @throws {TypeError} Will throw type error if type is an invalid type
|
308
|
-
* @returns {payload is T}
|
357
|
+
* @param {any} payload
|
358
|
+
* @returns {payload is undefined}
|
309
359
|
*/
|
310
|
-
declare function
|
311
|
-
|
312
|
-
[K in keyof typeof globalThis]: (typeof globalThis)[K] extends AnyClass ? K : never;
|
313
|
-
}[keyof typeof globalThis];
|
360
|
+
declare function isUndefined(payload: any): payload is undefined;
|
361
|
+
|
314
362
|
/**
|
315
|
-
*
|
316
|
-
* want to check if a value is an instance of a class that may not be defined in
|
317
|
-
* the current scope. For example, if you want to check if a value is an
|
318
|
-
* `OffscreenCanvas` instance, you might not want to do the song and dance of
|
319
|
-
* using `typeof OffscreenCanvas !== 'undefined'` and then shimming
|
320
|
-
* `OffscreenCanvas` if the types aren't around.
|
363
|
+
* Returns whether the payload is a WeakMap
|
321
364
|
*
|
322
|
-
* @
|
323
|
-
*
|
324
|
-
|
325
|
-
|
365
|
+
* @param {any} payload
|
366
|
+
* @returns {payload is WeakMap<any, any>}
|
367
|
+
*/
|
368
|
+
declare function isWeakMap(payload: any): payload is WeakMap<any, any>;
|
369
|
+
|
370
|
+
/**
|
371
|
+
* Returns whether the payload is a WeakSet
|
326
372
|
*
|
327
|
-
* @param
|
328
|
-
* @
|
373
|
+
* @param {any} payload
|
374
|
+
* @returns {payload is WeakSet<any>}
|
329
375
|
*/
|
330
|
-
declare function
|
331
|
-
|
332
|
-
|
376
|
+
declare function isWeakSet(payload: any): payload is WeakSet<any>;
|
377
|
+
|
378
|
+
type AnyAsyncFunction = (...args: any[]) => Promise<any>;
|
333
379
|
|
334
380
|
export { AnyAsyncFunction, AnyClass, AnyFunction, PlainObject, getType, isAnyObject, isArray, isBlob, isBoolean, isDate, isEmptyArray, isEmptyObject, isEmptyString, isError, isFile, isFullArray, isFullObject, isFullString, isFunction, isInstanceOf, isMap, isNaNValue, isNegativeNumber, isNull, isNullOrUndefined, isNumber, isObject, isObjectLike, isOneOf, isPlainObject, isPositiveNumber, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isType, isUndefined, isWeakMap, isWeakSet };
|