is-what 4.1.0

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/test/ava.ts ADDED
@@ -0,0 +1,419 @@
1
+ import test from 'ava'
2
+
3
+ import {
4
+ isError,
5
+ isEmptyArray,
6
+ isObject,
7
+ isPlainObject,
8
+ isAnyObject,
9
+ isUndefined,
10
+ isNull,
11
+ isNullOrUndefined,
12
+ isFunction,
13
+ isArray,
14
+ isString,
15
+ isEmptyString,
16
+ isFullString,
17
+ isBoolean,
18
+ isRegExp,
19
+ isNumber,
20
+ isPositiveNumber,
21
+ isNegativeNumber,
22
+ isDate,
23
+ isSymbol,
24
+ isPrimitive,
25
+ isType,
26
+ isMap,
27
+ isWeakMap,
28
+ isSet,
29
+ isWeakSet,
30
+ isFullArray,
31
+ // isBlob,
32
+ // isFile,
33
+ isPromise,
34
+ isNaNValue,
35
+ isEmptyObject,
36
+ isOneOf,
37
+ isFullObject,
38
+ } from '../src/index.js'
39
+
40
+ // TODO: test isBlob
41
+ // test('isBlob', () => {
42
+ // expect(isBlob(Blob)).toBe(false)
43
+ // expect(isBlob(new Blob())).toBe(true)
44
+ // })
45
+
46
+ // TODO: test isFile
47
+ // test('isFile', () => {
48
+ // expect(isFile(File)).toBe(false)
49
+ // expect(isFile(new File([''], '', { type: 'text/html' }))).toBe(true)
50
+ // })
51
+
52
+ test('Basic true tests', (t: any) => {
53
+ t.is(isError(new Error('')), true)
54
+ t.is(isUndefined(undefined), true)
55
+ t.is(isNull(null), true)
56
+ t.is(isNullOrUndefined(null), true)
57
+ t.is(isNullOrUndefined(undefined), true)
58
+ t.is(isObject({}), true)
59
+ t.is(isEmptyObject({}), true)
60
+ t.is(isFullObject({ 0: '' }), true)
61
+ t.is(isFullObject({ '': '' }), true)
62
+ t.is(isObject(new Object()), true)
63
+ t.is(isArray([]), true)
64
+ t.is(isEmptyArray([]), true)
65
+ t.is(isFullArray(['']), true)
66
+ t.is(isArray(new Array()), true)
67
+ t.is(isString(''), true)
68
+ t.is(isString('_'), true)
69
+ t.is(isEmptyString(''), true)
70
+ t.is(isFullString(' '), true)
71
+ t.is(isBoolean(true), true)
72
+ t.is(isBoolean(false), true)
73
+ t.is(isRegExp(/./), true)
74
+ t.is(isRegExp(/./gi), true)
75
+ t.is(isNumber(0), true)
76
+ t.is(isNumber(1), true)
77
+ t.is(isDate(new Date()), true)
78
+ t.is(isSymbol(Symbol()), true)
79
+ t.is(isMap(new Map()), true)
80
+ t.is(isWeakMap(new WeakMap()), true)
81
+ t.is(isSet(new Set()), true)
82
+ t.is(isWeakSet(new WeakSet()), true)
83
+ // t.is(isBlob(blob), true)
84
+ // t.is(isFile(new File([''], '', { type: 'text/html' })), true)
85
+ t.is(isPromise(new Promise((resolve, reject) => {})), true)
86
+ })
87
+
88
+ test('Basic false tests', (t: any) => {
89
+ t.is(isError({}), false)
90
+ t.is(isNumber(NaN), false)
91
+ t.is(isDate(new Date('_')), false)
92
+ t.is(isDate(NaN), false)
93
+ t.is(isUndefined(NaN), false)
94
+ t.is(isNull(NaN), false)
95
+ t.is(isObject(NaN), false)
96
+ t.is(isArray(NaN), false)
97
+ t.is(isString(NaN), false)
98
+ t.is(isEmptyString(' '), false)
99
+ t.is(isFullString(''), false)
100
+ t.is(isBoolean(NaN), false)
101
+ t.is(isRegExp(NaN), false)
102
+ t.is(isSymbol(NaN), false)
103
+ t.is(isMap(new WeakMap()), false)
104
+ t.is(isWeakMap(new Map()), false)
105
+ t.is(isSet(new WeakSet()), false)
106
+ t.is(isWeakSet(new Set()), false)
107
+ t.is(isNullOrUndefined(NaN), false)
108
+ })
109
+
110
+ test('isFunction', (t: any) => {
111
+ t.is(isFunction(NaN), false)
112
+ t.is(
113
+ isFunction(() => {}),
114
+ true
115
+ )
116
+ t.is(
117
+ isFunction(function () {}),
118
+ true
119
+ )
120
+ t.is(
121
+ isFunction(async () => {}),
122
+ true
123
+ )
124
+ t.is(
125
+ isFunction(async function () {}),
126
+ true
127
+ )
128
+ t.is(
129
+ isFunction(function* () {}),
130
+ true
131
+ )
132
+ t.is(
133
+ isFunction(async function* () {}),
134
+ true
135
+ )
136
+ const _ = { fn: () => {}, method() {} }
137
+ t.is(isFunction(_.fn), true)
138
+ t.is(isFunction(_.method), true)
139
+ })
140
+
141
+ test('isEmptyObject', (t: any) => {
142
+ t.is(isEmptyObject({}), true)
143
+ t.is(isEmptyObject(new Object()), true)
144
+
145
+ t.is(isEmptyObject('{}'), false)
146
+ t.is(isEmptyObject('{}'), false)
147
+ t.is(isEmptyObject(null), false)
148
+ t.is(isEmptyObject(new Date()), false)
149
+ t.is(isEmptyObject(new Error('')), false)
150
+ t.is(isEmptyObject(new Date()), false)
151
+ t.is(isEmptyObject(Symbol()), false)
152
+ t.is(isEmptyObject(new Map()), false)
153
+ t.is(isEmptyObject(new WeakMap()), false)
154
+ t.is(isEmptyObject(new Set()), false)
155
+ t.is(isEmptyObject(new WeakSet()), false)
156
+ })
157
+
158
+ test('isEmptyArray', (t: any) => {
159
+ t.is(isEmptyArray([]), true)
160
+ t.is(isEmptyArray(new Array()), true)
161
+ t.is(isEmptyArray(new Array(0)), true)
162
+
163
+ t.is(isEmptyArray(new Array(1)), false)
164
+ t.is(isEmptyArray([undefined]), false)
165
+ t.is(isEmptyArray(null), false)
166
+ t.is(isEmptyArray(new Date()), false)
167
+ t.is(isEmptyArray(new Error('')), false)
168
+ t.is(isEmptyArray(new Date()), false)
169
+ t.is(isEmptyArray(Symbol()), false)
170
+ t.is(isEmptyArray(new Map()), false)
171
+ t.is(isEmptyArray(new WeakMap()), false)
172
+ t.is(isEmptyArray(new Set()), false)
173
+ t.is(isEmptyArray(new WeakSet()), false)
174
+ })
175
+
176
+ test('isFullArray', (t: any) => {
177
+ t.is(isFullArray(new Array(1)), true)
178
+ t.is(isFullArray([undefined]), true)
179
+ t.is(isFullArray([null]), true)
180
+ t.is(isFullArray(['']), true)
181
+
182
+ t.is(isFullArray([]), false)
183
+ t.is(isFullArray(new Array()), false)
184
+ t.is(isFullArray(new Array(0)), false)
185
+
186
+ t.is(isFullArray(null), false)
187
+ t.is(isFullArray(new Date()), false)
188
+ t.is(isFullArray(new Error('')), false)
189
+ t.is(isFullArray(new Date()), false)
190
+ t.is(isFullArray(Symbol()), false)
191
+ t.is(isFullArray(new Map()), false)
192
+ t.is(isFullArray(new WeakMap()), false)
193
+ t.is(isFullArray(new Set()), false)
194
+ t.is(isFullArray(new WeakSet()), false)
195
+ })
196
+
197
+ test('isPositiveNumber / isNegativeNumber', (t: any) => {
198
+ t.is(isPositiveNumber(-1), false)
199
+ t.is(isPositiveNumber(0), false)
200
+ t.is(isPositiveNumber(1), true)
201
+ t.is(isNegativeNumber(-1), true)
202
+ t.is(isNegativeNumber(0), false)
203
+ t.is(isNegativeNumber(1), false)
204
+ })
205
+
206
+ test('NaN tests', (t: any) => {
207
+ t.is(isNaNValue(NaN), true)
208
+ t.is(isNaNValue(new Error('')), false)
209
+ t.is(isNaNValue(undefined), false)
210
+ t.is(isNaNValue(null), false)
211
+ t.is(isNaNValue(undefined), false)
212
+ t.is(isNaNValue({}), false)
213
+ t.is(isNaNValue(new Object()), false)
214
+ t.is(
215
+ isNaNValue(() => {}),
216
+ false
217
+ )
218
+ t.is(isNaNValue([]), false)
219
+ t.is(isNaNValue(new Array()), false)
220
+ t.is(isNaNValue(''), false)
221
+ t.is(isNaNValue('_'), false)
222
+ t.is(isNaNValue(''), false)
223
+ t.is(isNaNValue(' '), false)
224
+ t.is(isNaNValue(true), false)
225
+ t.is(isNaNValue(false), false)
226
+ t.is(isNaNValue(/./), false)
227
+ t.is(isNaNValue(/./gi), false)
228
+ t.is(isNaNValue(0), false)
229
+ t.is(isNaNValue(1), false)
230
+ t.is(isNaNValue(new Date()), false)
231
+ t.is(isNaNValue(Symbol()), false)
232
+ t.is(isNaNValue(new Map()), false)
233
+ t.is(isNaNValue(new WeakMap()), false)
234
+ t.is(isNaNValue(new Set()), false)
235
+ t.is(isNaNValue(new WeakSet()), false)
236
+ t.is(isNaNValue(new Promise((resolve, reject) => {})), false)
237
+ })
238
+
239
+ test('Primitive tests', (t: any) => {
240
+ // true
241
+ t.is(isPrimitive(0), true)
242
+ t.is(isPrimitive(''), true)
243
+ t.is(isPrimitive('str'), true)
244
+ t.is(isPrimitive(Symbol()), true)
245
+ t.is(isPrimitive(true), true)
246
+ t.is(isPrimitive(false), true)
247
+ t.is(isPrimitive(null), true)
248
+ t.is(isPrimitive(undefined), true)
249
+ // false
250
+ t.is(isPrimitive(NaN), false)
251
+ t.is(isPrimitive([]), false)
252
+ t.is(isPrimitive(new Array()), false)
253
+ t.is(isPrimitive({}), false)
254
+ t.is(isPrimitive(new Object()), false)
255
+ t.is(isPrimitive(new Date()), false)
256
+ t.is(
257
+ isPrimitive(() => {}),
258
+ false
259
+ )
260
+ })
261
+
262
+ test('Date exception', (t: any) => {
263
+ t.is(isDate(new Date('_')), false)
264
+ })
265
+
266
+ test('Generic isType', (t: any) => {
267
+ // -----------------------------
268
+ // This is correct old fashion syntax for classes, if this is missing
269
+ function MyClass() {}
270
+ MyClass.prototype.constructor = MyClass
271
+ // @ts-ignore
272
+ const myClass = new MyClass()
273
+ // -----------------------------
274
+ class MyOtherClass {
275
+ constructor() {}
276
+ }
277
+ // this is expected behaviour
278
+ t.is(isType('', String), true)
279
+ t.is(isType('_', String), true)
280
+ t.is(isType('Hello World', String), true)
281
+ t.is(isType(NaN, Number), true)
282
+ t.is(isType(0, Number), true)
283
+ t.is(isType(1, Number), true)
284
+ t.is(isType({}, Object), true)
285
+ t.is(isType(new Object(), Object), true)
286
+ t.is(isType([], Array), true)
287
+ t.is(isType(new Array(), Array), true)
288
+ t.is(
289
+ isType(() => {}, Function),
290
+ true
291
+ )
292
+ t.is(isType(true, Boolean), true)
293
+ t.is(isType(false, Boolean), true)
294
+ t.is(isType(new Date('_'), Date), true)
295
+ t.is(isType(new Date(), Date), true)
296
+ t.is(isType(/./, RegExp), true)
297
+ t.is(isType(/./gi, RegExp), true)
298
+ t.is(isType(myClass, MyClass), true)
299
+ t.is(isType(new MyOtherClass(), MyOtherClass), true)
300
+ t.is(isType(myClass, MyOtherClass), false)
301
+ t.is(isType(Symbol(), Symbol), true)
302
+ // t.is(isType(null, Null), true)
303
+ // t.is(isType(undefined, Undefined), true)
304
+ // It SHOULD fail
305
+ t.is(isType(5, String), false)
306
+ t.is(isType(null, Object), false)
307
+ // Not sure if this would be the expected behaviour but everything is an object
308
+ // so I would say so
309
+ t.is(isType(myClass, Object), true)
310
+ })
311
+
312
+ test('isObject vs isAnyObject', (t: any) => {
313
+ // -----------------------------
314
+ // This is correct old fashion syntax for classes, if this is missing
315
+ function MyClass() {}
316
+ MyClass.prototype.constructor = MyClass
317
+ // @ts-ignore
318
+ const myClass = new MyClass()
319
+ // -----------------------------
320
+ class MyClass2 {
321
+ constructor() {}
322
+ }
323
+ const myClass2 = new MyClass2()
324
+ const mySpecialObject = {}
325
+ Object.setPrototypeOf(mySpecialObject, {
326
+ toDate: function () {
327
+ return new Date()
328
+ },
329
+ })
330
+ // IS OBJECT
331
+ // plain object
332
+ t.is(isObject({}), true)
333
+ t.is(isObject(new Object()), true)
334
+ t.is(isPlainObject({}), true)
335
+ t.is(isPlainObject(new Object()), true)
336
+ // classes & prototypes
337
+ t.is(isObject(myClass), false)
338
+ t.is(isObject(myClass2), false)
339
+ t.is(isObject(mySpecialObject), false)
340
+ t.is(isPlainObject(myClass), false)
341
+ t.is(isPlainObject(myClass2), false)
342
+ t.is(isPlainObject(mySpecialObject), false)
343
+ // arrays and dates
344
+ t.is(isObject([]), false)
345
+ t.is(isObject(new Array()), false)
346
+ t.is(isObject(new Date('_')), false)
347
+ t.is(isObject(new Date()), false)
348
+ t.is(isPlainObject([]), false)
349
+ t.is(isPlainObject(new Array()), false)
350
+ t.is(isPlainObject(new Date('_')), false)
351
+ t.is(isPlainObject(new Date()), false)
352
+ // IS ANY OBJECT
353
+ // plain object
354
+ t.is(isAnyObject({}), true)
355
+ t.is(isAnyObject(new Object()), true)
356
+ // classes & prototypes
357
+ t.is(isAnyObject(myClass), true)
358
+ t.is(isAnyObject(myClass2), true)
359
+ t.is(isAnyObject(mySpecialObject), true)
360
+ // arrays and dates
361
+ t.is(isAnyObject([]), false)
362
+ t.is(isAnyObject(new Array()), false)
363
+ t.is(isAnyObject(new Date('_')), false)
364
+ t.is(isAnyObject(new Date()), false)
365
+ })
366
+
367
+ test('isOneOf', (t: any) => {
368
+ t.is(isOneOf(isString, isNumber)('_'), true)
369
+ t.is(isOneOf(isString, isNumber)(1), true)
370
+ t.is(isOneOf(isString, isNumber)(undefined), false)
371
+
372
+ t.is(isOneOf(isString, isNumber, isBoolean)('_'), true)
373
+ t.is(isOneOf(isString, isNumber, isBoolean)(1), true)
374
+ t.is(isOneOf(isString, isNumber, isBoolean)(true), true)
375
+ t.is(isOneOf(isString, isNumber, isBoolean)(undefined), false)
376
+
377
+ t.is(isOneOf(isString, isNumber, isBoolean, isArray)('_'), true)
378
+ t.is(isOneOf(isString, isNumber, isBoolean, isArray)(1), true)
379
+ t.is(isOneOf(isString, isNumber, isBoolean, isArray)(true), true)
380
+ t.is(isOneOf(isString, isNumber, isBoolean, isArray)([]), true)
381
+ t.is(isOneOf(isString, isNumber, isBoolean, isArray)(undefined), false)
382
+
383
+ t.is(isOneOf(isString, isNumber, isBoolean, isArray, isPlainObject)('_'), true)
384
+ t.is(isOneOf(isString, isNumber, isBoolean, isArray, isPlainObject)(1), true)
385
+ t.is(isOneOf(isString, isNumber, isBoolean, isArray, isPlainObject)(true), true)
386
+ t.is(isOneOf(isString, isNumber, isBoolean, isArray, isPlainObject)([]), true)
387
+ t.is(isOneOf(isString, isNumber, isBoolean, isArray, isPlainObject)({}), true)
388
+ t.is(isOneOf(isString, isNumber, isBoolean, isArray, isPlainObject)(undefined), false)
389
+ })
390
+
391
+ test('type related tests', (t: any) => {
392
+ t.pass()
393
+ // const fn: string | ((k: number) => string) = (p) => 'a'
394
+ // if (!isFunction(fn)) {
395
+ // fn
396
+ // }
397
+
398
+ // const a: Record<string, number> = {}
399
+
400
+ // a[fn(1)] = fn(2)
401
+
402
+ // const myArray: string | string[] = ['a', 'b']
403
+ // if (!isArray(myArray)) {
404
+ // myArray
405
+ // }
406
+
407
+ // const a: Record<string, number> = {}
408
+
409
+ // a[myArray[1]] = myArray[0]
410
+
411
+ // const myArray: string | any[] = [1, 2, 'a', 'b']
412
+ // if (!isArray(myArray)) {
413
+ // myArray
414
+ // }
415
+
416
+ // const a: Record<string, number> = {}
417
+
418
+ // a[myArray[1]] = myArray[0]
419
+ })
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "module": "ES2020",
5
+ "target": "ES2019",
6
+ "lib": ["ES2020", "DOM"],
7
+ "strict": true,
8
+ "moduleResolution": "node",
9
+ "isolatedModules": true,
10
+ "esModuleInterop": true,
11
+ "declaration": true,
12
+ "declarationDir": "./types/"
13
+ },
14
+ "include": ["src/**/*", "test/**/*"]
15
+ }
@@ -0,0 +1,267 @@
1
+ export declare type AnyFunction = (...args: any[]) => any;
2
+ export declare type AnyAsyncFunction = (...args: any[]) => Promise<any>;
3
+ export declare type AnyClass = new (...args: any[]) => any;
4
+ export declare type PlainObject = Record<string | number | symbol, any>;
5
+ declare type TypeGuard<A, B extends A> = (payload: A) => payload is B;
6
+ /**
7
+ * Returns the object type of the given payload
8
+ *
9
+ * @param {*} payload
10
+ * @returns {string}
11
+ */
12
+ export declare function getType(payload: any): string;
13
+ /**
14
+ * Returns whether the payload is undefined
15
+ *
16
+ * @param {*} payload
17
+ * @returns {payload is undefined}
18
+ */
19
+ export declare function isUndefined(payload: any): payload is undefined;
20
+ /**
21
+ * Returns whether the payload is null
22
+ *
23
+ * @param {*} payload
24
+ * @returns {payload is null}
25
+ */
26
+ export declare function isNull(payload: any): payload is null;
27
+ /**
28
+ * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
29
+ *
30
+ * @param {*} payload
31
+ * @returns {payload is PlainObject}
32
+ */
33
+ export declare function isPlainObject(payload: any): payload is PlainObject;
34
+ /**
35
+ * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
36
+ *
37
+ * @param {*} payload
38
+ * @returns {payload is PlainObject}
39
+ */
40
+ export declare function isObject(payload: any): payload is PlainObject;
41
+ /**
42
+ * Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)
43
+ *
44
+ * @param {*} payload
45
+ * @returns {payload is { [K in any]: never }}
46
+ */
47
+ export declare function isEmptyObject(payload: any): payload is {
48
+ [K in any]: never;
49
+ };
50
+ /**
51
+ * Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)
52
+ *
53
+ * @param {*} payload
54
+ * @returns {payload is PlainObject}
55
+ */
56
+ export declare function isFullObject(payload: any): payload is PlainObject;
57
+ /**
58
+ * Returns whether the payload is an any kind of object (including special classes or objects with different prototypes)
59
+ *
60
+ * @param {*} payload
61
+ * @returns {payload is PlainObject}
62
+ */
63
+ export declare function isAnyObject(payload: any): payload is PlainObject;
64
+ /**
65
+ * Returns whether the payload is an object like a type passed in < >
66
+ *
67
+ * Usage: isObjectLike<{id: any}>(payload) // will make sure it's an object and has an `id` prop.
68
+ *
69
+ * @template T this must be passed in < >
70
+ * @param {*} payload
71
+ * @returns {payload is T}
72
+ */
73
+ export declare function isObjectLike<T extends PlainObject>(payload: any): payload is T;
74
+ /**
75
+ * Returns whether the payload is a function (regular or async)
76
+ *
77
+ * @param {*} payload
78
+ * @returns {payload is AnyFunction}
79
+ */
80
+ export declare function isFunction(payload: any): payload is AnyFunction;
81
+ /**
82
+ * Returns whether the payload is an array
83
+ *
84
+ * @param {any} payload
85
+ * @returns {payload is any[]}
86
+ */
87
+ export declare function isArray(payload: any): payload is any[];
88
+ /**
89
+ * Returns whether the payload is a an array with at least 1 item
90
+ *
91
+ * @param {*} payload
92
+ * @returns {payload is any[]}
93
+ */
94
+ export declare function isFullArray(payload: any): payload is any[];
95
+ /**
96
+ * Returns whether the payload is a an empty array
97
+ *
98
+ * @param {*} payload
99
+ * @returns {payload is []}
100
+ */
101
+ export declare function isEmptyArray(payload: any): payload is [];
102
+ /**
103
+ * Returns whether the payload is a string
104
+ *
105
+ * @param {*} payload
106
+ * @returns {payload is string}
107
+ */
108
+ export declare function isString(payload: any): payload is string;
109
+ /**
110
+ * Returns whether the payload is a string, BUT returns false for ''
111
+ *
112
+ * @param {*} payload
113
+ * @returns {payload is string}
114
+ */
115
+ export declare function isFullString(payload: any): payload is string;
116
+ /**
117
+ * Returns whether the payload is ''
118
+ *
119
+ * @param {*} payload
120
+ * @returns {payload is string}
121
+ */
122
+ export declare function isEmptyString(payload: any): payload is string;
123
+ /**
124
+ * Returns whether the payload is a number (but not NaN)
125
+ *
126
+ * This will return `false` for `NaN`!!
127
+ *
128
+ * @param {*} payload
129
+ * @returns {payload is number}
130
+ */
131
+ export declare function isNumber(payload: any): payload is number;
132
+ /**
133
+ * Returns whether the payload is a positive number (but not 0)
134
+ *
135
+ * @param {*} payload
136
+ * @returns {payload is number}
137
+ */
138
+ export declare function isPositiveNumber(payload: any): payload is number;
139
+ /**
140
+ * Returns whether the payload is a negative number (but not 0)
141
+ *
142
+ * @param {*} payload
143
+ * @returns {payload is number}
144
+ */
145
+ export declare function isNegativeNumber(payload: any): payload is number;
146
+ /**
147
+ * Returns whether the payload is a boolean
148
+ *
149
+ * @param {*} payload
150
+ * @returns {payload is boolean}
151
+ */
152
+ export declare function isBoolean(payload: any): payload is boolean;
153
+ /**
154
+ * Returns whether the payload is a regular expression (RegExp)
155
+ *
156
+ * @param {*} payload
157
+ * @returns {payload is RegExp}
158
+ */
159
+ export declare function isRegExp(payload: any): payload is RegExp;
160
+ /**
161
+ * Returns whether the payload is a Map
162
+ *
163
+ * @param {*} payload
164
+ * @returns {payload is Map<any, any>}
165
+ */
166
+ export declare function isMap(payload: any): payload is Map<any, any>;
167
+ /**
168
+ * Returns whether the payload is a WeakMap
169
+ *
170
+ * @param {*} payload
171
+ * @returns {payload is WeakMap<any, any>}
172
+ */
173
+ export declare function isWeakMap(payload: any): payload is WeakMap<any, any>;
174
+ /**
175
+ * Returns whether the payload is a Set
176
+ *
177
+ * @param {*} payload
178
+ * @returns {payload is Set<any>}
179
+ */
180
+ export declare function isSet(payload: any): payload is Set<any>;
181
+ /**
182
+ * Returns whether the payload is a WeakSet
183
+ *
184
+ * @param {*} payload
185
+ * @returns {payload is WeakSet<any>}
186
+ */
187
+ export declare function isWeakSet(payload: any): payload is WeakSet<any>;
188
+ /**
189
+ * Returns whether the payload is a Symbol
190
+ *
191
+ * @param {*} payload
192
+ * @returns {payload is symbol}
193
+ */
194
+ export declare function isSymbol(payload: any): payload is symbol;
195
+ /**
196
+ * Returns whether the payload is a Date, and that the date is valid
197
+ *
198
+ * @param {*} payload
199
+ * @returns {payload is Date}
200
+ */
201
+ export declare function isDate(payload: any): payload is Date;
202
+ /**
203
+ * Returns whether the payload is a Blob
204
+ *
205
+ * @param {*} payload
206
+ * @returns {payload is Blob}
207
+ */
208
+ export declare function isBlob(payload: any): payload is Blob;
209
+ /**
210
+ * Returns whether the payload is a File
211
+ *
212
+ * @param {*} payload
213
+ * @returns {payload is File}
214
+ */
215
+ export declare function isFile(payload: any): payload is File;
216
+ /**
217
+ * Returns whether the payload is a Promise
218
+ *
219
+ * @param {*} payload
220
+ * @returns {payload is Promise<any>}
221
+ */
222
+ export declare function isPromise(payload: any): payload is Promise<any>;
223
+ /**
224
+ * Returns whether the payload is an Error
225
+ *
226
+ * @param {*} payload
227
+ * @returns {payload is Error}
228
+ */
229
+ export declare function isError(payload: any): payload is Error;
230
+ /**
231
+ * Returns whether the payload is literally the value `NaN` (it's `NaN` and also a `number`)
232
+ *
233
+ * @param {*} payload
234
+ * @returns {payload is typeof NaN}
235
+ */
236
+ export declare function isNaNValue(payload: any): payload is typeof NaN;
237
+ /**
238
+ * Returns whether the payload is a primitive type (eg. Boolean | Null | Undefined | Number | String | Symbol)
239
+ *
240
+ * @param {*} payload
241
+ * @returns {(payload is boolean | null | undefined | number | string | symbol)}
242
+ */
243
+ export declare function isPrimitive(payload: any): payload is boolean | null | undefined | number | string | symbol;
244
+ /**
245
+ * Returns true whether the payload is null or undefined
246
+ *
247
+ * @param {*} payload
248
+ * @returns {(payload is null | undefined)}
249
+ */
250
+ export declare const isNullOrUndefined: TypeGuard<any, null | undefined>;
251
+ export declare function isOneOf<A, B extends A, C extends A>(a: TypeGuard<A, B>, b: TypeGuard<A, C>): TypeGuard<A, B | C>;
252
+ export 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>;
253
+ export 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>;
254
+ export 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>;
255
+ /**
256
+ * Does a generic check to check that the given payload is of a given type.
257
+ * In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!);
258
+ * It will, however, differentiate between object and null
259
+ *
260
+ * @template T
261
+ * @param {*} payload
262
+ * @param {T} type
263
+ * @throws {TypeError} Will throw type error if type is an invalid type
264
+ * @returns {payload is T}
265
+ */
266
+ export declare function isType<T extends AnyFunction | AnyClass>(payload: any, type: T): payload is T;
267
+ export {};