@augment-vir/assert 31.0.0 → 31.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.
Files changed (63) hide show
  1. package/dist/assertions/boolean.d.ts +20 -26
  2. package/dist/assertions/boolean.js +185 -41
  3. package/dist/assertions/boundary.d.ts +40 -256
  4. package/dist/assertions/boundary.js +265 -229
  5. package/dist/assertions/enum.d.ts +12 -13
  6. package/dist/assertions/enum.js +98 -20
  7. package/dist/assertions/equality/entry-equality.d.ts +11 -15
  8. package/dist/assertions/equality/entry-equality.js +210 -43
  9. package/dist/assertions/equality/json-equality.d.ts +11 -15
  10. package/dist/assertions/equality/json-equality.js +144 -43
  11. package/dist/assertions/equality/simple-equality.d.ts +39 -46
  12. package/dist/assertions/equality/simple-equality.js +316 -61
  13. package/dist/assertions/extendable-assertions.d.ts +0 -12
  14. package/dist/assertions/extendable-assertions.js +0 -12
  15. package/dist/assertions/http.d.ts +10 -14
  16. package/dist/assertions/http.js +96 -28
  17. package/dist/assertions/instance.d.ts +10 -18
  18. package/dist/assertions/instance.js +92 -26
  19. package/dist/assertions/keys.d.ts +59 -138
  20. package/dist/assertions/keys.js +279 -162
  21. package/dist/assertions/length.d.ts +30 -212
  22. package/dist/assertions/length.js +117 -175
  23. package/dist/assertions/nullish.d.ts +8 -20
  24. package/dist/assertions/nullish.js +85 -27
  25. package/dist/assertions/numeric.d.ts +67 -81
  26. package/dist/assertions/numeric.js +564 -133
  27. package/dist/assertions/output.d.ts +2 -3
  28. package/dist/assertions/output.js +1 -7
  29. package/dist/assertions/primitive.d.ts +33 -40
  30. package/dist/assertions/primitive.js +232 -66
  31. package/dist/assertions/promise.d.ts +20 -30
  32. package/dist/assertions/promise.js +244 -53
  33. package/dist/assertions/regexp.d.ts +12 -14
  34. package/dist/assertions/regexp.js +84 -21
  35. package/dist/assertions/runtime-type.d.ts +99 -150
  36. package/dist/assertions/runtime-type.js +805 -229
  37. package/dist/assertions/throws.d.ts +24 -25
  38. package/dist/assertions/throws.js +43 -5
  39. package/dist/assertions/uuid.d.ts +11 -16
  40. package/dist/assertions/uuid.js +91 -22
  41. package/dist/assertions/values.d.ts +81 -210
  42. package/dist/assertions/values.js +627 -234
  43. package/dist/augments/guards/assert-wrap.d.ts +7 -4
  44. package/dist/augments/guards/assert-wrap.js +5 -4
  45. package/dist/augments/guards/check-wrap.d.ts +7 -5
  46. package/dist/augments/guards/check-wrap.js +5 -4
  47. package/dist/augments/guards/check.d.ts +5 -5
  48. package/dist/augments/guards/check.js +5 -4
  49. package/dist/augments/guards/wait-until.d.ts +8 -4
  50. package/dist/augments/guards/wait-until.js +7 -8
  51. package/dist/guard-types/guard-group.d.ts +5 -2
  52. package/dist/guard-types/wait-until-function.d.ts +2 -10
  53. package/dist/guard-types/wait-until-function.js +1 -9
  54. package/dist/index.d.ts +1 -0
  55. package/package.json +2 -2
  56. package/dist/guard-types/assert-wrap-function.d.ts +0 -12
  57. package/dist/guard-types/assert-wrap-function.js +0 -14
  58. package/dist/guard-types/check-function.d.ts +0 -14
  59. package/dist/guard-types/check-function.js +0 -22
  60. package/dist/guard-types/check-wrap-wrapper-function.d.ts +0 -12
  61. package/dist/guard-types/check-wrap-wrapper-function.js +0 -19
  62. package/dist/guard-types/guard-override.d.ts +0 -4
  63. package/dist/guard-types/guard-override.js +0 -10
@@ -1,127 +1,467 @@
1
1
  import { stringify, } from '@augment-vir/core';
2
2
  import { AssertionError } from '../augments/assertion.error.js';
3
- import { autoGuard, autoGuardSymbol } from '../guard-types/guard-override.js';
4
- function isNotArray(actual, failureMessage) {
5
- if (Array.isArray(actual)) {
6
- throw new AssertionError(`'${stringify(actual)}' is an array.`, failureMessage);
7
- }
8
- }
9
- function isNotBigInt(actual, failureMessage) {
10
- if (typeof actual === 'bigint') {
11
- throw new AssertionError(`'${stringify(actual)}' is a bigint.`, failureMessage);
12
- }
13
- }
14
- function isNotBoolean(actual, failureMessage) {
15
- if (typeof actual === 'boolean') {
16
- throw new AssertionError(`'${stringify(actual)}' is a boolean.`, failureMessage);
17
- }
18
- }
19
- function isNotFunction(actual, failureMessage) {
20
- if (typeof actual === 'function') {
21
- throw new AssertionError(`'${stringify(actual)}' is a function.`, failureMessage);
22
- }
23
- }
24
- function isNotNumber(actual, failureMessage) {
25
- if (typeof actual === 'number') {
26
- throw new AssertionError(`'${stringify(actual)}' is a number.`, failureMessage);
27
- }
28
- }
29
- function isNotObject(actual, failureMessage) {
30
- if (!Array.isArray(actual) && typeof actual === 'object' && !!actual) {
31
- throw new AssertionError(`'${stringify(actual)}' is a non-null object.`, failureMessage);
32
- }
33
- }
34
- function isNotString(actual, failureMessage) {
35
- if (typeof actual === 'string') {
36
- throw new AssertionError(`'${stringify(actual)}' is a string.`, failureMessage);
37
- }
38
- }
39
- function isNotSymbol(actual, failureMessage) {
40
- if (typeof actual === 'symbol') {
41
- throw new AssertionError(`'${stringify(actual)}' is a symbol.`, failureMessage);
42
- }
43
- }
44
- function isNotUndefined(actual, failureMessage) {
45
- if (typeof actual === 'undefined') {
46
- throw new AssertionError(`'${stringify(actual)}' is a undefined.`, failureMessage);
47
- }
48
- }
49
- function isNotNull(actual, failureMessage) {
50
- if (actual === null) {
51
- throw new AssertionError(`'${stringify(actual)}' is a null.`, failureMessage);
52
- }
53
- }
54
- function isArray(actual, failureMessage) {
55
- if (!Array.isArray(actual)) {
56
- throw new AssertionError(`'${stringify(actual)}' is not an array.`, failureMessage);
57
- }
58
- }
59
- function isBigInt(actual, failureMessage) {
60
- if (typeof actual !== 'bigint') {
61
- throw new AssertionError(`'${stringify(actual)}' is not a bigint.`, failureMessage);
62
- }
63
- }
64
- function isBoolean(actual, failureMessage) {
65
- if (typeof actual !== 'boolean') {
66
- throw new AssertionError(`'${stringify(actual)}' is not a boolean.`, failureMessage);
67
- }
68
- }
69
- function isFunction(actual, failureMessage) {
70
- if (typeof actual !== 'function') {
71
- throw new AssertionError(`'${stringify(actual)}' is not a function.`, failureMessage);
72
- }
73
- }
74
- export function isNumber(actual, failureMessage) {
75
- if (typeof actual !== 'number' || isNaN(actual)) {
76
- throw new AssertionError(`'${stringify(actual)}' is not a number.`, failureMessage);
77
- }
78
- }
79
- function isObject(actual, failureMessage) {
80
- if (Array.isArray(actual) || typeof actual !== 'object' || !actual) {
81
- throw new AssertionError(`'${stringify(actual)}' is not a non-null object.`, failureMessage);
82
- }
83
- }
84
- function isString(actual, failureMessage) {
85
- if (typeof actual !== 'string') {
86
- throw new AssertionError(`'${stringify(actual)}' is not a string.`, failureMessage);
87
- }
88
- }
89
- function isSymbol(actual, failureMessage) {
90
- if (typeof actual !== 'symbol') {
91
- throw new AssertionError(`'${stringify(actual)}' is not a symbol.`, failureMessage);
92
- }
93
- }
94
- function isUndefined(actual, failureMessage) {
95
- if (typeof actual !== 'undefined') {
96
- throw new AssertionError(`'${stringify(actual)}' is not a undefined.`, failureMessage);
97
- }
98
- }
99
- function isNull(actual, failureMessage) {
100
- if (actual !== null) {
101
- throw new AssertionError(`'${stringify(actual)}' is not nul.`, failureMessage);
102
- }
103
- }
3
+ import { createWaitUntil } from '../guard-types/wait-until-function.js';
104
4
  const assertions = {
105
- isArray,
106
- isBigInt,
107
- isBoolean,
108
- isFunction,
109
- isNull,
110
- isNumber,
111
- isObject,
112
- isString,
113
- isSymbol,
114
- isUndefined,
115
- isNotArray,
116
- isNotBigInt,
117
- isNotBoolean,
118
- isNotFunction,
119
- isNotNull,
120
- isNotNumber,
121
- isNotObject,
122
- isNotString,
123
- isNotSymbol,
124
- isNotUndefined,
5
+ /**
6
+ * Asserts that a value is an array.
7
+ *
8
+ * Type guards the value.
9
+ *
10
+ * @example
11
+ *
12
+ * ```ts
13
+ * import {assert} from '@augment-vir/assert';
14
+ *
15
+ * assert.isArray([]); // passes
16
+ * assert.isArray({length: 4}); // fails
17
+ * ```
18
+ *
19
+ * @throws {@link AssertionError} If the assertion failed.
20
+ * @see
21
+ * - {@link assert.isNotArray} : the opposite assertion.
22
+ */
23
+ isArray(actual, failureMessage) {
24
+ if (!Array.isArray(actual)) {
25
+ throw new AssertionError(`'${stringify(actual)}' is not an array.`, failureMessage);
26
+ }
27
+ },
28
+ /**
29
+ * Asserts that a value is a BigInt.
30
+ *
31
+ * Type guards the value.
32
+ *
33
+ * @example
34
+ *
35
+ * ```ts
36
+ * import {assert} from '@augment-vir/assert';
37
+ *
38
+ * assert.isBigInt(123n); // passes
39
+ * assert.isBigInt(123); // fails
40
+ * ```
41
+ *
42
+ * @throws {@link AssertionError} If the assertion failed.
43
+ * @see
44
+ * - {@link assert.isNotBigInt} : the opposite assertion.
45
+ */
46
+ isBigInt(actual, failureMessage) {
47
+ if (typeof actual !== 'bigint') {
48
+ throw new AssertionError(`'${stringify(actual)}' is not a bigint.`, failureMessage);
49
+ }
50
+ },
51
+ /**
52
+ * Asserts that a value is a boolean.
53
+ *
54
+ * Type guards the value.
55
+ *
56
+ * @example
57
+ *
58
+ * ```ts
59
+ * import {assert} from '@augment-vir/assert';
60
+ *
61
+ * assert.isBoolean(true); // passes
62
+ * assert.isBoolean('true'); // fails
63
+ * ```
64
+ *
65
+ * @throws {@link AssertionError} If the assertion failed.
66
+ * @see
67
+ * - {@link assert.isNotBoolean} : the opposite assertion.
68
+ */
69
+ isBoolean(actual, failureMessage) {
70
+ if (typeof actual !== 'boolean') {
71
+ throw new AssertionError(`'${stringify(actual)}' is not a boolean.`, failureMessage);
72
+ }
73
+ },
74
+ /**
75
+ * Asserts that a value is a function.
76
+ *
77
+ * Type guards the value.
78
+ *
79
+ * @example
80
+ *
81
+ * ```ts
82
+ * import {assert} from '@augment-vir/assert';
83
+ *
84
+ * assert.isFunction(() => {}); // passes
85
+ * assert.isFunction({}); // fails
86
+ * ```
87
+ *
88
+ * @throws {@link AssertionError} If the assertion failed.
89
+ * @see
90
+ * - {@link assert.isNotFunction} : the opposite assertion.
91
+ */
92
+ isFunction(actual, failureMessage) {
93
+ if (typeof actual !== 'function') {
94
+ throw new AssertionError(`'${stringify(actual)}' is not a function.`, failureMessage);
95
+ }
96
+ },
97
+ /**
98
+ * Asserts that a value is exactly `null`.
99
+ *
100
+ * Type guards the value.
101
+ *
102
+ * @example
103
+ *
104
+ * ```ts
105
+ * import {assert} from '@augment-vir/assert';
106
+ *
107
+ * assert.isNull(null); // passes
108
+ * assert.isNull(undefined); // fails
109
+ * ```
110
+ *
111
+ * @throws {@link AssertionError} If the assertion failed.
112
+ * @see
113
+ * - {@link assert.isNotFunction} : the opposite assertion.
114
+ */
115
+ isNull(actual, failureMessage) {
116
+ if (actual !== null) {
117
+ throw new AssertionError(`'${stringify(actual)}' is not nul.`, failureMessage);
118
+ }
119
+ },
120
+ /**
121
+ * Asserts that a value is a number. This excludes `NaN`.
122
+ *
123
+ * Type guards the value.
124
+ *
125
+ * @example
126
+ *
127
+ * ```ts
128
+ * import {assert} from '@augment-vir/assert';
129
+ *
130
+ * assert.isNumber(123); // passes
131
+ * assert.isNumber(123n); // fails
132
+ * ```
133
+ *
134
+ * @throws {@link AssertionError} If the assertion failed.
135
+ * @see
136
+ * - {@link assert.isNotFunction} : the opposite assertion.
137
+ */
138
+ isNumber(actual, failureMessage) {
139
+ if (typeof actual !== 'number' || isNaN(actual)) {
140
+ throw new AssertionError(`'${stringify(actual)}' is not a number.`, failureMessage);
141
+ }
142
+ },
143
+ /**
144
+ * Asserts that a value is an object. This excludes arrays.
145
+ *
146
+ * Type guards the value.
147
+ *
148
+ * @example
149
+ *
150
+ * ```ts
151
+ * import {assert} from '@augment-vir/assert';
152
+ *
153
+ * assert.isObject({}); // passes
154
+ * assert.isObject([]); // fails
155
+ * ```
156
+ *
157
+ * @throws {@link AssertionError} If the assertion failed.
158
+ * @see
159
+ * - {@link assert.isNotFunction} : the opposite assertion.
160
+ */
161
+ isObject(actual, failureMessage) {
162
+ if (Array.isArray(actual) || typeof actual !== 'object' || !actual) {
163
+ throw new AssertionError(`'${stringify(actual)}' is not a non-null object.`, failureMessage);
164
+ }
165
+ },
166
+ /**
167
+ * Asserts that a value is a string.
168
+ *
169
+ * Type guards the value.
170
+ *
171
+ * @example
172
+ *
173
+ * ```ts
174
+ * import {assert} from '@augment-vir/assert';
175
+ *
176
+ * assert.isString(''); // passes
177
+ * assert.isString(5); // fails
178
+ * ```
179
+ *
180
+ * @throws {@link AssertionError} If the assertion failed.
181
+ * @see
182
+ * - {@link assert.isNotFunction} : the opposite assertion.
183
+ */
184
+ isString(actual, failureMessage) {
185
+ if (typeof actual !== 'string') {
186
+ throw new AssertionError(`'${stringify(actual)}' is not a string.`, failureMessage);
187
+ }
188
+ },
189
+ /**
190
+ * Asserts that a value is a symbol.
191
+ *
192
+ * Type guards the value.
193
+ *
194
+ * @example
195
+ *
196
+ * ```ts
197
+ * import {assert} from '@augment-vir/assert';
198
+ *
199
+ * assert.isSymbol(Symbol('my-symbol')); // passes
200
+ * assert.isSymbol('my-symbol'); // fails
201
+ * ```
202
+ *
203
+ * @throws {@link AssertionError} If the assertion failed.
204
+ * @see
205
+ * - {@link assert.isNotFunction} : the opposite assertion.
206
+ */
207
+ isSymbol(actual, failureMessage) {
208
+ if (typeof actual !== 'symbol') {
209
+ throw new AssertionError(`'${stringify(actual)}' is not a symbol.`, failureMessage);
210
+ }
211
+ },
212
+ /**
213
+ * Asserts that a value is exactly `undefined`.
214
+ *
215
+ * Type guards the value.
216
+ *
217
+ * @example
218
+ *
219
+ * ```ts
220
+ * import {assert} from '@augment-vir/assert';
221
+ *
222
+ * assert.isUndefined(undefined); // passes
223
+ * assert.isUndefined(null); // fails
224
+ * ```
225
+ *
226
+ * @throws {@link AssertionError} If the assertion failed.
227
+ * @see
228
+ * - {@link assert.isNotFunction} : the opposite assertion.
229
+ */
230
+ isUndefined(actual, failureMessage) {
231
+ if (typeof actual !== 'undefined') {
232
+ throw new AssertionError(`'${stringify(actual)}' is not a undefined.`, failureMessage);
233
+ }
234
+ },
235
+ /**
236
+ * Asserts that a value is _not_ an array.
237
+ *
238
+ * Type guards the value.
239
+ *
240
+ * @example
241
+ *
242
+ * ```ts
243
+ * import {assert} from '@augment-vir/assert';
244
+ *
245
+ * assert.isNotArray([]); // fails
246
+ * assert.isNotArray({length: 4}); // passes
247
+ * ```
248
+ *
249
+ * @throws {@link AssertionError} If the assertion failed.
250
+ * @see
251
+ * - {@link assert.isArray} : the opposite assertion.
252
+ */
253
+ isNotArray(actual, failureMessage) {
254
+ if (Array.isArray(actual)) {
255
+ throw new AssertionError(`'${stringify(actual)}' is an array.`, failureMessage);
256
+ }
257
+ },
258
+ /**
259
+ * Asserts that a value is _not_ a BigInt.
260
+ *
261
+ * Type guards the value.
262
+ *
263
+ * @example
264
+ *
265
+ * ```ts
266
+ * import {assert} from '@augment-vir/assert';
267
+ *
268
+ * assert.isNotBigInt(123n); // fails
269
+ * assert.isNotBigInt(123); // passes
270
+ * ```
271
+ *
272
+ * @throws {@link AssertionError} If the assertion failed.
273
+ * @see
274
+ * - {@link assert.isBigInt} : the opposite assertion.
275
+ */
276
+ isNotBigInt(actual, failureMessage) {
277
+ if (typeof actual === 'bigint') {
278
+ throw new AssertionError(`'${stringify(actual)}' is a bigint.`, failureMessage);
279
+ }
280
+ },
281
+ /**
282
+ * Asserts that a value is _not_ a boolean.
283
+ *
284
+ * Type guards the value.
285
+ *
286
+ * @example
287
+ *
288
+ * ```ts
289
+ * import {assert} from '@augment-vir/assert';
290
+ *
291
+ * assert.isNotBoolean(true); // fails
292
+ * assert.isNotBoolean('true'); // passes
293
+ * ```
294
+ *
295
+ * @throws {@link AssertionError} If the assertion failed.
296
+ * @see
297
+ * - {@link assert.isBoolean} : the opposite assertion.
298
+ */
299
+ isNotBoolean(actual, failureMessage) {
300
+ if (typeof actual === 'boolean') {
301
+ throw new AssertionError(`'${stringify(actual)}' is a boolean.`, failureMessage);
302
+ }
303
+ },
304
+ /**
305
+ * Asserts that a value is _not_ a function.
306
+ *
307
+ * Type guards the value.
308
+ *
309
+ * @example
310
+ *
311
+ * ```ts
312
+ * import {assert} from '@augment-vir/assert';
313
+ *
314
+ * assert.isNotFunction(() => {}); // fails
315
+ * assert.isNotFunction({}); // passes
316
+ * ```
317
+ *
318
+ * @throws {@link AssertionError} If the assertion failed.
319
+ * @see
320
+ * - {@link assert.isFunction} : the opposite assertion.
321
+ */
322
+ isNotFunction(actual, failureMessage) {
323
+ if (typeof actual === 'function') {
324
+ throw new AssertionError(`'${stringify(actual)}' is a function.`, failureMessage);
325
+ }
326
+ },
327
+ /**
328
+ * Asserts that a value is _not_ exactly `null`.
329
+ *
330
+ * Type guards the value.
331
+ *
332
+ * @example
333
+ *
334
+ * ```ts
335
+ * import {assert} from '@augment-vir/assert';
336
+ *
337
+ * assert.isNotNull(null); // fails
338
+ * assert.isNotNull(undefined); // passes
339
+ * ```
340
+ *
341
+ * @throws {@link AssertionError} If the assertion failed. @see
342
+ * @see
343
+ * - {@link assert.isFunction} : the opposite assertion.
344
+ */
345
+ isNotNull(actual, failureMessage) {
346
+ if (actual === null) {
347
+ throw new AssertionError(`'${stringify(actual)}' is a null.`, failureMessage);
348
+ }
349
+ },
350
+ /**
351
+ * Asserts that a value is _not_ a number. This includes `NaN`.
352
+ *
353
+ * Type guards the value.
354
+ *
355
+ * @example
356
+ *
357
+ * ```ts
358
+ * import {assert} from '@augment-vir/assert';
359
+ *
360
+ * assert.isNotNumber(123); // fails
361
+ * assert.isNotNumber(123n); // passes
362
+ * ```
363
+ *
364
+ * @throws {@link AssertionError} If the assertion failed.
365
+ * @see
366
+ * - {@link assert.isNotFunction} : the opposite assertion.
367
+ */
368
+ isNotNumber(actual, failureMessage) {
369
+ if (typeof actual === 'number') {
370
+ throw new AssertionError(`'${stringify(actual)}' is a number.`, failureMessage);
371
+ }
372
+ },
373
+ /**
374
+ * Asserts that a value is _not_ an object. This includes arrays.
375
+ *
376
+ * Type guards the value.
377
+ *
378
+ * @example
379
+ *
380
+ * ```ts
381
+ * import {assert} from '@augment-vir/assert';
382
+ *
383
+ * assert.isNotObject({}); // fails
384
+ * assert.isNotObject([]); // passes
385
+ * ```
386
+ *
387
+ * @throws {@link AssertionError} If the assertion failed.
388
+ * @see
389
+ * - {@link assert.isFunction} : the opposite assertion.
390
+ */
391
+ isNotObject(actual, failureMessage) {
392
+ if (!Array.isArray(actual) && typeof actual === 'object' && !!actual) {
393
+ throw new AssertionError(`'${stringify(actual)}' is a non-null object.`, failureMessage);
394
+ }
395
+ },
396
+ /**
397
+ * Asserts that a value is _not_ a string.
398
+ *
399
+ * Type guards the value.
400
+ *
401
+ * @example
402
+ *
403
+ * ```ts
404
+ * import {assert} from '@augment-vir/assert';
405
+ *
406
+ * assert.isNotString(''); // fails
407
+ * assert.isNotString(5); // passes
408
+ * ```
409
+ *
410
+ * @throws {@link AssertionError} If the assertion failed.
411
+ * @see
412
+ * - {@link assert.isFunction} : the opposite assertion.
413
+ */
414
+ isNotString(actual, failureMessage) {
415
+ if (typeof actual === 'string') {
416
+ throw new AssertionError(`'${stringify(actual)}' is a string.`, failureMessage);
417
+ }
418
+ },
419
+ /**
420
+ * Asserts that a value is _not_ a symbol.
421
+ *
422
+ * Type guards the value.
423
+ *
424
+ * @example
425
+ *
426
+ * ```ts
427
+ * import {assert} from '@augment-vir/assert';
428
+ *
429
+ * assert.isNotSymbol(Symbol('my-symbol')); // fails
430
+ * assert.isNotSymbol('my-symbol'); // passes
431
+ * ```
432
+ *
433
+ * @throws {@link AssertionError} If the assertion failed.
434
+ * @see
435
+ * - {@link assert.isFunction} : the opposite assertion.
436
+ */
437
+ isNotSymbol(actual, failureMessage) {
438
+ if (typeof actual === 'symbol') {
439
+ throw new AssertionError(`'${stringify(actual)}' is a symbol.`, failureMessage);
440
+ }
441
+ },
442
+ /**
443
+ * Asserts that a value is _not_ exactly `undefined`.
444
+ *
445
+ * Type guards the value.
446
+ *
447
+ * @example
448
+ *
449
+ * ```ts
450
+ * import {assert} from '@augment-vir/assert';
451
+ *
452
+ * assert.isNotUndefined(undefined); // fails
453
+ * assert.isNotUndefined(null); // passes
454
+ * ```
455
+ *
456
+ * @throws {@link AssertionError} If the assertion failed.
457
+ * @see
458
+ * - {@link assert.isFunction} : the opposite assertion.
459
+ */
460
+ isNotUndefined(actual, failureMessage) {
461
+ if (typeof actual === 'undefined') {
462
+ throw new AssertionError(`'${stringify(actual)}' is a undefined.`, failureMessage);
463
+ }
464
+ },
125
465
  };
126
466
  export const runtimeTypeGuards = {
127
467
  assert: assertions,
@@ -143,7 +483,9 @@ export const runtimeTypeGuards = {
143
483
  * @see
144
484
  * - {@link check.isNotArray} : the opposite check.
145
485
  */
146
- isArray: autoGuard(),
486
+ isArray(actual) {
487
+ return Array.isArray(actual);
488
+ },
147
489
  /**
148
490
  * Checks that a value is a BigInt.
149
491
  *
@@ -161,7 +503,9 @@ export const runtimeTypeGuards = {
161
503
  * @see
162
504
  * - {@link check.isNotBigInt} : the opposite check.
163
505
  */
164
- isBigInt: autoGuardSymbol,
506
+ isBigInt(actual) {
507
+ return typeof actual === 'bigint';
508
+ },
165
509
  /**
166
510
  * Checks that a value is a boolean.
167
511
  *
@@ -179,7 +523,9 @@ export const runtimeTypeGuards = {
179
523
  * @see
180
524
  * - {@link check.isNotBoolean} : the opposite check.
181
525
  */
182
- isBoolean: autoGuardSymbol,
526
+ isBoolean(actual) {
527
+ return typeof actual === 'boolean';
528
+ },
183
529
  /**
184
530
  * Checks that a value is a function.
185
531
  *
@@ -197,7 +543,9 @@ export const runtimeTypeGuards = {
197
543
  * @see
198
544
  * - {@link check.isNotFunction} : the opposite check.
199
545
  */
200
- isFunction: autoGuard(),
546
+ isFunction(actual) {
547
+ return typeof actual === 'function';
548
+ },
201
549
  /**
202
550
  * Checks that a value is exactly `null`.
203
551
  *
@@ -215,7 +563,9 @@ export const runtimeTypeGuards = {
215
563
  * @see
216
564
  * - {@link check.isNotFunction} : the opposite check.
217
565
  */
218
- isNull: autoGuardSymbol,
566
+ isNull(actual) {
567
+ return actual === null;
568
+ },
219
569
  /**
220
570
  * Checks that a value is a number. This excludes `NaN`.
221
571
  *
@@ -233,7 +583,9 @@ export const runtimeTypeGuards = {
233
583
  * @see
234
584
  * - {@link check.isNotFunction} : the opposite check.
235
585
  */
236
- isNumber: autoGuardSymbol,
586
+ isNumber(actual) {
587
+ return typeof actual === 'number';
588
+ },
237
589
  /**
238
590
  * Checks that a value is an object. This excludes arrays.
239
591
  *
@@ -251,7 +603,9 @@ export const runtimeTypeGuards = {
251
603
  * @see
252
604
  * - {@link check.isNotFunction} : the opposite check.
253
605
  */
254
- isObject: autoGuardSymbol,
606
+ isObject(actual) {
607
+ return !Array.isArray(actual) && typeof actual === 'object' && !!actual;
608
+ },
255
609
  /**
256
610
  * Checks that a value is a string.
257
611
  *
@@ -269,7 +623,9 @@ export const runtimeTypeGuards = {
269
623
  * @see
270
624
  * - {@link check.isNotFunction} : the opposite check.
271
625
  */
272
- isString: autoGuardSymbol,
626
+ isString(actual) {
627
+ return typeof actual === 'string';
628
+ },
273
629
  /**
274
630
  * Checks that a value is a symbol.
275
631
  *
@@ -287,7 +643,9 @@ export const runtimeTypeGuards = {
287
643
  * @see
288
644
  * - {@link check.isNotFunction} : the opposite check.
289
645
  */
290
- isSymbol: autoGuardSymbol,
646
+ isSymbol(actual) {
647
+ return typeof actual === 'symbol';
648
+ },
291
649
  /**
292
650
  * Checks that a value is exactly `undefined`.
293
651
  *
@@ -305,7 +663,9 @@ export const runtimeTypeGuards = {
305
663
  * @see
306
664
  * - {@link check.isNotFunction} : the opposite check.
307
665
  */
308
- isUndefined: autoGuardSymbol,
666
+ isUndefined(actual) {
667
+ return actual === undefined;
668
+ },
309
669
  /**
310
670
  * Checks that a value is _not_ an array.
311
671
  *
@@ -323,7 +683,9 @@ export const runtimeTypeGuards = {
323
683
  * @see
324
684
  * - {@link check.isArray} : the opposite check.
325
685
  */
326
- isNotArray: autoGuard(),
686
+ isNotArray(actual) {
687
+ return !Array.isArray(actual);
688
+ },
327
689
  /**
328
690
  * Checks that a value is _not_ a BigInt.
329
691
  *
@@ -341,7 +703,9 @@ export const runtimeTypeGuards = {
341
703
  * @see
342
704
  * - {@link check.isBigInt} : the opposite check.
343
705
  */
344
- isNotBigInt: autoGuard(),
706
+ isNotBigInt(actual) {
707
+ return typeof actual !== 'bigint';
708
+ },
345
709
  /**
346
710
  * Checks that a value is _not_ a boolean.
347
711
  *
@@ -359,7 +723,9 @@ export const runtimeTypeGuards = {
359
723
  * @see
360
724
  * - {@link check.isBoolean} : the opposite check.
361
725
  */
362
- isNotBoolean: autoGuard(),
726
+ isNotBoolean(actual) {
727
+ return typeof actual !== 'boolean';
728
+ },
363
729
  /**
364
730
  * Checks that a value is _not_ a function.
365
731
  *
@@ -377,7 +743,9 @@ export const runtimeTypeGuards = {
377
743
  * @see
378
744
  * - {@link check.isFunction} : the opposite check.
379
745
  */
380
- isNotFunction: autoGuard(),
746
+ isNotFunction(actual) {
747
+ return typeof actual !== 'function';
748
+ },
381
749
  /**
382
750
  * Checks that a value is _not_ exactly `null`.
383
751
  *
@@ -395,7 +763,9 @@ export const runtimeTypeGuards = {
395
763
  * @see
396
764
  * - {@link check.isFunction} : the opposite check.
397
765
  */
398
- isNotNull: autoGuard(),
766
+ isNotNull(actual) {
767
+ return actual !== null;
768
+ },
399
769
  /**
400
770
  * Checks that a value is _not_ a number. This includes `NaN`.
401
771
  *
@@ -413,7 +783,9 @@ export const runtimeTypeGuards = {
413
783
  * @see
414
784
  * - {@link check.isNotFunction} : the opposite check.
415
785
  */
416
- isNotNumber: autoGuard(),
786
+ isNotNumber(actual) {
787
+ return typeof actual !== 'number';
788
+ },
417
789
  /**
418
790
  * Checks that a value is _not_ an object. This includes arrays.
419
791
  *
@@ -431,7 +803,9 @@ export const runtimeTypeGuards = {
431
803
  * @see
432
804
  * - {@link check.isFunction} : the opposite check.
433
805
  */
434
- isNotObject: autoGuard(),
806
+ isNotObject(actual) {
807
+ return Array.isArray(actual) || typeof actual !== 'object' || !actual;
808
+ },
435
809
  /**
436
810
  * Checks that a value is _not_ a string.
437
811
  *
@@ -449,7 +823,9 @@ export const runtimeTypeGuards = {
449
823
  * @see
450
824
  * - {@link check.isFunction} : the opposite check.
451
825
  */
452
- isNotString: autoGuard(),
826
+ isNotString(actual) {
827
+ return typeof actual !== 'string';
828
+ },
453
829
  /**
454
830
  * Checks that a value is _not_ a symbol.
455
831
  *
@@ -467,7 +843,9 @@ export const runtimeTypeGuards = {
467
843
  * @see
468
844
  * - {@link check.isFunction} : the opposite check.
469
845
  */
470
- isNotSymbol: autoGuard(),
846
+ isNotSymbol(actual) {
847
+ return typeof actual !== 'symbol';
848
+ },
471
849
  /**
472
850
  * Checks that a value is _not_ exactly `undefined`.
473
851
  *
@@ -485,7 +863,9 @@ export const runtimeTypeGuards = {
485
863
  * @see
486
864
  * - {@link check.isFunction} : the opposite check.
487
865
  */
488
- isNotUndefined: autoGuard(),
866
+ isNotUndefined(actual) {
867
+ return typeof actual !== 'undefined';
868
+ },
489
869
  },
490
870
  assertWrap: {
491
871
  /**
@@ -507,7 +887,12 @@ export const runtimeTypeGuards = {
507
887
  * @see
508
888
  * - {@link assertWrap.isNotArray} : the opposite assertion.
509
889
  */
510
- isArray: autoGuard(),
890
+ isArray(actual, failureMessage) {
891
+ if (!Array.isArray(actual)) {
892
+ throw new AssertionError(`'${stringify(actual)}' is not an array.`, failureMessage);
893
+ }
894
+ return actual;
895
+ },
511
896
  /**
512
897
  * Asserts that a value is a BigInt. Returns the value if the assertion passes.
513
898
  *
@@ -527,7 +912,12 @@ export const runtimeTypeGuards = {
527
912
  * @see
528
913
  * - {@link assertWrap.isNotBigInt} : the opposite assertion.
529
914
  */
530
- isBigInt: autoGuardSymbol,
915
+ isBigInt(actual, failureMessage) {
916
+ if (typeof actual !== 'bigint') {
917
+ throw new AssertionError(`'${stringify(actual)}' is not a bigint.`, failureMessage);
918
+ }
919
+ return actual;
920
+ },
531
921
  /**
532
922
  * Asserts that a value is a boolean. Returns the value if the assertion passes.
533
923
  *
@@ -547,7 +937,12 @@ export const runtimeTypeGuards = {
547
937
  * @see
548
938
  * - {@link assertWrap.isNotBoolean} : the opposite assertion.
549
939
  */
550
- isBoolean: autoGuardSymbol,
940
+ isBoolean(actual, failureMessage) {
941
+ if (typeof actual !== 'boolean') {
942
+ throw new AssertionError(`'${stringify(actual)}' is not a boolean.`, failureMessage);
943
+ }
944
+ return actual;
945
+ },
551
946
  /**
552
947
  * Asserts that a value is a function. Returns the value if the assertion passes.
553
948
  *
@@ -567,7 +962,12 @@ export const runtimeTypeGuards = {
567
962
  * @see
568
963
  * - {@link assertWrap.isNotFunction} : the opposite assertion.
569
964
  */
570
- isFunction: autoGuard(),
965
+ isFunction(actual, failureMessage) {
966
+ if (typeof actual !== 'function') {
967
+ throw new AssertionError(`'${stringify(actual)}' is not a function.`, failureMessage);
968
+ }
969
+ return actual;
970
+ },
571
971
  /**
572
972
  * Asserts that a value is exactly `null. Returns the value if the assertion passes.
573
973
  *
@@ -587,7 +987,12 @@ export const runtimeTypeGuards = {
587
987
  * @see
588
988
  * - {@link assertWrap.isNotFunction} : the opposite assertion.
589
989
  */
590
- isNull: autoGuardSymbol,
990
+ isNull(actual, failureMessage) {
991
+ if (actual !== null) {
992
+ throw new AssertionError(`'${stringify(actual)}' is not nul.`, failureMessage);
993
+ }
994
+ return actual;
995
+ },
591
996
  /**
592
997
  * Asserts that a value is a number. This excludes `NaN. Returns the value if the assertion
593
998
  * passes.
@@ -608,7 +1013,12 @@ export const runtimeTypeGuards = {
608
1013
  * @see
609
1014
  * - {@link assertWrap.isNotFunction} : the opposite assertion.
610
1015
  */
611
- isNumber: autoGuardSymbol,
1016
+ isNumber(actual, failureMessage) {
1017
+ if (typeof actual !== 'number' || isNaN(actual)) {
1018
+ throw new AssertionError(`'${stringify(actual)}' is not a number.`, failureMessage);
1019
+ }
1020
+ return actual;
1021
+ },
612
1022
  /**
613
1023
  * Asserts that a value is an object. This excludes arrays. Returns the value if the
614
1024
  * assertion passes.
@@ -629,7 +1039,12 @@ export const runtimeTypeGuards = {
629
1039
  * @see
630
1040
  * - {@link assertWrap.isNotFunction} : the opposite assertion.
631
1041
  */
632
- isObject: autoGuardSymbol,
1042
+ isObject(actual, failureMessage) {
1043
+ if (Array.isArray(actual) || typeof actual !== 'object' || !actual) {
1044
+ throw new AssertionError(`'${stringify(actual)}' is not a non-null object.`, failureMessage);
1045
+ }
1046
+ return actual;
1047
+ },
633
1048
  /**
634
1049
  * Asserts that a value is a string. Returns the value if the assertion passes.
635
1050
  *
@@ -649,7 +1064,12 @@ export const runtimeTypeGuards = {
649
1064
  * @see
650
1065
  * - {@link assertWrap.isNotFunction} : the opposite assertion.
651
1066
  */
652
- isString: autoGuardSymbol,
1067
+ isString(actual, failureMessage) {
1068
+ if (typeof actual !== 'string') {
1069
+ throw new AssertionError(`'${stringify(actual)}' is not a string.`, failureMessage);
1070
+ }
1071
+ return actual;
1072
+ },
653
1073
  /**
654
1074
  * Trying to assign a unique symbol to another variable kills the `unique` part of the
655
1075
  * symbol. this seems to be a bug with TypeScript itself.
@@ -678,7 +1098,12 @@ export const runtimeTypeGuards = {
678
1098
  * @see
679
1099
  * - {@link assertWrap.isNotFunction} : the opposite assertion.
680
1100
  */
681
- isSymbol: autoGuard(),
1101
+ isSymbol(actual, failureMessage) {
1102
+ if (typeof actual !== 'symbol') {
1103
+ throw new AssertionError(`'${stringify(actual)}' is not a symbol.`, failureMessage);
1104
+ }
1105
+ return actual;
1106
+ },
682
1107
  /**
683
1108
  * Asserts that a value is exactly `undefined. Returns the value if the assertion passes.
684
1109
  *
@@ -698,7 +1123,12 @@ export const runtimeTypeGuards = {
698
1123
  * @see
699
1124
  * - {@link assertWrap.isNotFunction} : the opposite assertion.
700
1125
  */
701
- isUndefined: autoGuardSymbol,
1126
+ isUndefined(actual, failureMessage) {
1127
+ if (typeof actual !== 'undefined') {
1128
+ throw new AssertionError(`'${stringify(actual)}' is not a undefined.`, failureMessage);
1129
+ }
1130
+ return actual;
1131
+ },
702
1132
  /**
703
1133
  * Asserts that a value is _not_ an array. Returns the value if the assertion passes.
704
1134
  *
@@ -718,7 +1148,12 @@ export const runtimeTypeGuards = {
718
1148
  * @see
719
1149
  * - {@link assertWrap.isArray} : the opposite assertion.
720
1150
  */
721
- isNotArray: autoGuard(),
1151
+ isNotArray(actual, failureMessage) {
1152
+ if (Array.isArray(actual)) {
1153
+ throw new AssertionError(`'${stringify(actual)}' is an array.`, failureMessage);
1154
+ }
1155
+ return actual;
1156
+ },
722
1157
  /**
723
1158
  * Asserts that a value is _not_ a BigInt. Returns the value if the assertion passes.
724
1159
  *
@@ -738,7 +1173,12 @@ export const runtimeTypeGuards = {
738
1173
  * @see
739
1174
  * - {@link assertWrap.isBigInt} : the opposite assertion.
740
1175
  */
741
- isNotBigInt: autoGuard(),
1176
+ isNotBigInt(actual, failureMessage) {
1177
+ if (typeof actual === 'bigint') {
1178
+ throw new AssertionError(`'${stringify(actual)}' is a bigint.`, failureMessage);
1179
+ }
1180
+ return actual;
1181
+ },
742
1182
  /**
743
1183
  * Asserts that a value is _not_ a boolean. Returns the value if the assertion passes.
744
1184
  *
@@ -758,7 +1198,12 @@ export const runtimeTypeGuards = {
758
1198
  * @see
759
1199
  * - {@link assertWrap.isBoolean} : the opposite assertion.
760
1200
  */
761
- isNotBoolean: autoGuard(),
1201
+ isNotBoolean(actual, failureMessage) {
1202
+ if (typeof actual === 'boolean') {
1203
+ throw new AssertionError(`'${stringify(actual)}' is a boolean.`, failureMessage);
1204
+ }
1205
+ return actual;
1206
+ },
762
1207
  /**
763
1208
  * Asserts that a value is _not_ a function. Returns the value if the assertion passes.
764
1209
  *
@@ -778,7 +1223,12 @@ export const runtimeTypeGuards = {
778
1223
  * @see
779
1224
  * - {@link assertWrap.isFunction} : the opposite assertion.
780
1225
  */
781
- isNotFunction: autoGuard(),
1226
+ isNotFunction(actual, failureMessage) {
1227
+ if (typeof actual === 'function') {
1228
+ throw new AssertionError(`'${stringify(actual)}' is a function.`, failureMessage);
1229
+ }
1230
+ return actual;
1231
+ },
782
1232
  /**
783
1233
  * Asserts that a value is _not_ exactly `null. Returns the value if the assertion passes.
784
1234
  *
@@ -798,7 +1248,12 @@ export const runtimeTypeGuards = {
798
1248
  * @see
799
1249
  * - {@link assertWrap.isFunction} : the opposite assertion.
800
1250
  */
801
- isNotNull: autoGuard(),
1251
+ isNotNull(actual, failureMessage) {
1252
+ if (actual === null) {
1253
+ throw new AssertionError(`'${stringify(actual)}' is a null.`, failureMessage);
1254
+ }
1255
+ return actual;
1256
+ },
802
1257
  /**
803
1258
  * Asserts that a value is _not_ a number. This includes `NaN. Returns the value if the
804
1259
  * assertion passes.
@@ -819,7 +1274,12 @@ export const runtimeTypeGuards = {
819
1274
  * @see
820
1275
  * - {@link assertWrap.isNotFunction} : the opposite assertion.
821
1276
  */
822
- isNotNumber: autoGuard(),
1277
+ isNotNumber(actual, failureMessage) {
1278
+ if (typeof actual === 'number') {
1279
+ throw new AssertionError(`'${stringify(actual)}' is a number.`, failureMessage);
1280
+ }
1281
+ return actual;
1282
+ },
823
1283
  /**
824
1284
  * Asserts that a value is _not_ an object. This includes arrays. Returns the value if the
825
1285
  * assertion passes.
@@ -840,7 +1300,12 @@ export const runtimeTypeGuards = {
840
1300
  * @see
841
1301
  * - {@link assertWrap.isFunction} : the opposite assertion.
842
1302
  */
843
- isNotObject: autoGuard(),
1303
+ isNotObject(actual, failureMessage) {
1304
+ if (!Array.isArray(actual) && typeof actual === 'object' && !!actual) {
1305
+ throw new AssertionError(`'${stringify(actual)}' is a non-null object.`, failureMessage);
1306
+ }
1307
+ return actual;
1308
+ },
844
1309
  /**
845
1310
  * Asserts that a value is _not_ a string. Returns the value if the assertion passes.
846
1311
  *
@@ -860,7 +1325,12 @@ export const runtimeTypeGuards = {
860
1325
  * @see
861
1326
  * - {@link assertWrap.isFunction} : the opposite assertion.
862
1327
  */
863
- isNotString: autoGuard(),
1328
+ isNotString(actual, failureMessage) {
1329
+ if (typeof actual === 'string') {
1330
+ throw new AssertionError(`'${stringify(actual)}' is a string.`, failureMessage);
1331
+ }
1332
+ return actual;
1333
+ },
864
1334
  /**
865
1335
  * Asserts that a value is _not_ a symbol. Returns the value if the assertion passes.
866
1336
  *
@@ -880,7 +1350,12 @@ export const runtimeTypeGuards = {
880
1350
  * @see
881
1351
  * - {@link assertWrap.isFunction} : the opposite assertion.
882
1352
  */
883
- isNotSymbol: autoGuard(),
1353
+ isNotSymbol(actual, failureMessage) {
1354
+ if (typeof actual === 'symbol') {
1355
+ throw new AssertionError(`'${stringify(actual)}' is a symbol.`, failureMessage);
1356
+ }
1357
+ return actual;
1358
+ },
884
1359
  /**
885
1360
  * Asserts that a value is _not_ exactly `undefined. Returns the value if the assertion
886
1361
  * passes.
@@ -901,7 +1376,12 @@ export const runtimeTypeGuards = {
901
1376
  * @see
902
1377
  * - {@link assertWrap.isFunction} : the opposite assertion.
903
1378
  */
904
- isNotUndefined: autoGuard(),
1379
+ isNotUndefined(actual, failureMessage) {
1380
+ if (typeof actual === 'undefined') {
1381
+ throw new AssertionError(`'${stringify(actual)}' is a undefined.`, failureMessage);
1382
+ }
1383
+ return actual;
1384
+ },
905
1385
  },
906
1386
  checkWrap: {
907
1387
  /**
@@ -923,7 +1403,14 @@ export const runtimeTypeGuards = {
923
1403
  * @see
924
1404
  * - {@link checkWrap.isNotArray} : the opposite check.
925
1405
  */
926
- isArray: autoGuard(),
1406
+ isArray(actual) {
1407
+ if (Array.isArray(actual)) {
1408
+ return actual;
1409
+ }
1410
+ else {
1411
+ return undefined;
1412
+ }
1413
+ },
927
1414
  /**
928
1415
  * Checks that a value is a BigInt. Returns the value if the check passes, otherwise
929
1416
  * `undefined`.
@@ -943,7 +1430,14 @@ export const runtimeTypeGuards = {
943
1430
  * @see
944
1431
  * - {@link checkWrap.isNotBigInt} : the opposite check.
945
1432
  */
946
- isBigInt: autoGuardSymbol,
1433
+ isBigInt(actual) {
1434
+ if (typeof actual === 'bigint') {
1435
+ return actual;
1436
+ }
1437
+ else {
1438
+ return undefined;
1439
+ }
1440
+ },
947
1441
  /**
948
1442
  * Checks that a value is a boolean. Returns the value if the check passes, otherwise
949
1443
  * `undefined`.
@@ -963,7 +1457,14 @@ export const runtimeTypeGuards = {
963
1457
  * @see
964
1458
  * - {@link checkWrap.isNotBoolean} : the opposite check.
965
1459
  */
966
- isBoolean: autoGuardSymbol,
1460
+ isBoolean(actual) {
1461
+ if (typeof actual === 'boolean') {
1462
+ return actual;
1463
+ }
1464
+ else {
1465
+ return undefined;
1466
+ }
1467
+ },
967
1468
  /**
968
1469
  * Checks that a value is a function. Returns the value if the check passes, otherwise
969
1470
  * `undefined`.
@@ -983,7 +1484,14 @@ export const runtimeTypeGuards = {
983
1484
  * @see
984
1485
  * - {@link checkWrap.isNotFunction} : the opposite check.
985
1486
  */
986
- isFunction: autoGuard(),
1487
+ isFunction(actual) {
1488
+ if (typeof actual === 'function') {
1489
+ return actual;
1490
+ }
1491
+ else {
1492
+ return undefined;
1493
+ }
1494
+ },
987
1495
  /**
988
1496
  * Checks that a value is exactly `null. Returns the value if the check passes, otherwise
989
1497
  * `undefined`.
@@ -1003,7 +1511,14 @@ export const runtimeTypeGuards = {
1003
1511
  * @see
1004
1512
  * - {@link checkWrap.isNotFunction} : the opposite check.
1005
1513
  */
1006
- isNull: autoGuardSymbol,
1514
+ isNull(actual) {
1515
+ if (actual === null) {
1516
+ return actual;
1517
+ }
1518
+ else {
1519
+ return undefined;
1520
+ }
1521
+ },
1007
1522
  /**
1008
1523
  * Checks that a value is a number. This excludes `NaN. Returns the value if the check
1009
1524
  * passes, otherwise `undefined`.
@@ -1023,7 +1538,14 @@ export const runtimeTypeGuards = {
1023
1538
  * @see
1024
1539
  * - {@link checkWrap.isNotFunction} : the opposite check.
1025
1540
  */
1026
- isNumber: autoGuardSymbol,
1541
+ isNumber(actual) {
1542
+ if (typeof actual === 'number') {
1543
+ return actual;
1544
+ }
1545
+ else {
1546
+ return undefined;
1547
+ }
1548
+ },
1027
1549
  /**
1028
1550
  * Checks that a value is an object. This excludes arrays. Returns the value if the check
1029
1551
  * passes, otherwise `undefined`.
@@ -1043,7 +1565,14 @@ export const runtimeTypeGuards = {
1043
1565
  * @see
1044
1566
  * - {@link checkWrap.isNotFunction} : the opposite check.
1045
1567
  */
1046
- isObject: autoGuardSymbol,
1568
+ isObject(actual) {
1569
+ if (!Array.isArray(actual) && typeof actual === 'object' && !!actual) {
1570
+ return actual;
1571
+ }
1572
+ else {
1573
+ return undefined;
1574
+ }
1575
+ },
1047
1576
  /**
1048
1577
  * Checks that a value is a string. Returns the value if the check passes, otherwise
1049
1578
  * `undefined`.
@@ -1063,7 +1592,14 @@ export const runtimeTypeGuards = {
1063
1592
  * @see
1064
1593
  * - {@link checkWrap.isNotFunction} : the opposite check.
1065
1594
  */
1066
- isString: autoGuardSymbol,
1595
+ isString(actual) {
1596
+ if (typeof actual === 'string') {
1597
+ return actual;
1598
+ }
1599
+ else {
1600
+ return undefined;
1601
+ }
1602
+ },
1067
1603
  /**
1068
1604
  * Checks that a value is a symbol. Returns the value if the check passes, otherwise
1069
1605
  * `undefined`.
@@ -1083,32 +1619,14 @@ export const runtimeTypeGuards = {
1083
1619
  * @see
1084
1620
  * - {@link checkWrap.isNotFunction} : the opposite check.
1085
1621
  */
1086
- isSymbol: autoGuardSymbol,
1087
- /**
1088
- * It doesn't make any sense for `checkWrap.isUndefined` to exist. If the input is
1089
- * `undefined`, it returns `undefined`. If the input isn't `undefined`, it still returns
1090
- * `undefined`.
1091
- */
1092
- /**
1093
- * Checks that a value is exactly `undefined. Returns the value if the check passes,
1094
- * otherwise `undefined`.
1095
- *
1096
- * Type guards the value.
1097
- *
1098
- * @example
1099
- *
1100
- * ```ts
1101
- * import {checkWrap} from '@augment-vir/assert';
1102
- *
1103
- * checkWrap.isUndefined(undefined); // returns `undefined`
1104
- * checkWrap.isUndefined(null); // returns `undefined`
1105
- * ```
1106
- *
1107
- * @returns The value if the check passes. Otherwise, `undefined`.
1108
- * @see
1109
- * - {@link checkWrap.isNotFunction} : the opposite check.
1110
- */
1111
- isUndefined: undefined,
1622
+ isSymbol(actual) {
1623
+ if (typeof actual === 'symbol') {
1624
+ return actual;
1625
+ }
1626
+ else {
1627
+ return undefined;
1628
+ }
1629
+ },
1112
1630
  /**
1113
1631
  * Checks that a value is _not_ an array. Returns the value if the check passes, otherwise
1114
1632
  * `undefined`.
@@ -1128,7 +1646,14 @@ export const runtimeTypeGuards = {
1128
1646
  * @see
1129
1647
  * - {@link checkWrap.isArray} : the opposite check.
1130
1648
  */
1131
- isNotArray: autoGuard(),
1649
+ isNotArray(actual) {
1650
+ if (Array.isArray(actual)) {
1651
+ return undefined;
1652
+ }
1653
+ else {
1654
+ return actual;
1655
+ }
1656
+ },
1132
1657
  /**
1133
1658
  * Checks that a value is _not_ a BigInt. Returns the value if the check passes, otherwise
1134
1659
  * `undefined`.
@@ -1148,7 +1673,14 @@ export const runtimeTypeGuards = {
1148
1673
  * @see
1149
1674
  * - {@link checkWrap.isBigInt} : the opposite check.
1150
1675
  */
1151
- isNotBigInt: autoGuard(),
1676
+ isNotBigInt(actual) {
1677
+ if (typeof actual === 'bigint') {
1678
+ return undefined;
1679
+ }
1680
+ else {
1681
+ return actual;
1682
+ }
1683
+ },
1152
1684
  /**
1153
1685
  * Checks that a value is _not_ a boolean. Returns the value if the check passes, otherwise
1154
1686
  * `undefined`.
@@ -1168,7 +1700,14 @@ export const runtimeTypeGuards = {
1168
1700
  * @see
1169
1701
  * - {@link checkWrap.isBoolean} : the opposite check.
1170
1702
  */
1171
- isNotBoolean: autoGuard(),
1703
+ isNotBoolean(actual) {
1704
+ if (typeof actual === 'boolean') {
1705
+ return undefined;
1706
+ }
1707
+ else {
1708
+ return actual;
1709
+ }
1710
+ },
1172
1711
  /**
1173
1712
  * Checks that a value is _not_ a function. Returns the value if the check passes, otherwise
1174
1713
  * `undefined`.
@@ -1188,7 +1727,14 @@ export const runtimeTypeGuards = {
1188
1727
  * @see
1189
1728
  * - {@link checkWrap.isFunction} : the opposite check.
1190
1729
  */
1191
- isNotFunction: autoGuard(),
1730
+ isNotFunction(actual) {
1731
+ if (typeof actual === 'function') {
1732
+ return undefined;
1733
+ }
1734
+ else {
1735
+ return actual;
1736
+ }
1737
+ },
1192
1738
  /**
1193
1739
  * Checks that a value is _not_ exactly `null. Returns the value if the check passes,
1194
1740
  * otherwise `undefined`.
@@ -1208,7 +1754,14 @@ export const runtimeTypeGuards = {
1208
1754
  * @see
1209
1755
  * - {@link checkWrap.isFunction} : the opposite check.
1210
1756
  */
1211
- isNotNull: autoGuard(),
1757
+ isNotNull(actual) {
1758
+ if (actual === null) {
1759
+ return undefined;
1760
+ }
1761
+ else {
1762
+ return actual;
1763
+ }
1764
+ },
1212
1765
  /**
1213
1766
  * Checks that a value is _not_ a number. This includes `NaN. Returns the value if the check
1214
1767
  * passes, otherwise `undefined`.
@@ -1228,7 +1781,14 @@ export const runtimeTypeGuards = {
1228
1781
  * @see
1229
1782
  * - {@link checkWrap.isNotFunction} : the opposite check.
1230
1783
  */
1231
- isNotNumber: autoGuard(),
1784
+ isNotNumber(actual) {
1785
+ if (typeof actual === 'number') {
1786
+ return undefined;
1787
+ }
1788
+ else {
1789
+ return actual;
1790
+ }
1791
+ },
1232
1792
  /**
1233
1793
  * Checks that a value is _not_ an object. This includes arrays. Returns the value if the
1234
1794
  * check passes, otherwise `undefined`.
@@ -1248,7 +1808,14 @@ export const runtimeTypeGuards = {
1248
1808
  * @see
1249
1809
  * - {@link checkWrap.isFunction} : the opposite check.
1250
1810
  */
1251
- isNotObject: autoGuard(),
1811
+ isNotObject(actual) {
1812
+ if (Array.isArray(actual) || typeof actual !== 'object' || !actual) {
1813
+ return actual;
1814
+ }
1815
+ else {
1816
+ return undefined;
1817
+ }
1818
+ },
1252
1819
  /**
1253
1820
  * Checks that a value is _not_ a string. Returns the value if the check passes, otherwise
1254
1821
  * `undefined`.
@@ -1268,7 +1835,14 @@ export const runtimeTypeGuards = {
1268
1835
  * @see
1269
1836
  * - {@link checkWrap.isFunction} : the opposite check.
1270
1837
  */
1271
- isNotString: autoGuard(),
1838
+ isNotString(actual) {
1839
+ if (typeof actual === 'string') {
1840
+ return undefined;
1841
+ }
1842
+ else {
1843
+ return actual;
1844
+ }
1845
+ },
1272
1846
  /**
1273
1847
  * Checks that a value is _not_ a symbol. Returns the value if the check passes, otherwise
1274
1848
  * `undefined`.
@@ -1288,12 +1862,14 @@ export const runtimeTypeGuards = {
1288
1862
  * @see
1289
1863
  * - {@link checkWrap.isFunction} : the opposite check.
1290
1864
  */
1291
- isNotSymbol: autoGuard(),
1292
- /**
1293
- * It doesn't make any sense for `checkWrap.isNotUndefined` to exist. If the input is not
1294
- * `undefined`, then it still returns `undefined`.
1295
- */
1296
- isNotUndefined: undefined,
1865
+ isNotSymbol(actual) {
1866
+ if (typeof actual === 'symbol') {
1867
+ return undefined;
1868
+ }
1869
+ else {
1870
+ return actual;
1871
+ }
1872
+ },
1297
1873
  },
1298
1874
  waitUntil: {
1299
1875
  /**
@@ -1317,7 +1893,7 @@ export const runtimeTypeGuards = {
1317
1893
  * @see
1318
1894
  * - {@link waitUntil.isNotArray} : the opposite assertion.
1319
1895
  */
1320
- isArray: autoGuard(),
1896
+ isArray: createWaitUntil(assertions.isArray),
1321
1897
  /**
1322
1898
  * Repeatedly calls a callback until its output is a BigInt. Once the callback output
1323
1899
  * passes, it is returned. If the attempts time out, an error is thrown.
@@ -1337,7 +1913,7 @@ export const runtimeTypeGuards = {
1337
1913
  * @see
1338
1914
  * - {@link waitUntil.isNotBigInt} : the opposite assertion.
1339
1915
  */
1340
- isBigInt: autoGuardSymbol,
1916
+ isBigInt: createWaitUntil(assertions.isBigInt),
1341
1917
  /**
1342
1918
  * Repeatedly calls a callback until its output is a boolean. Once the callback output
1343
1919
  * passes, it is returned. If the attempts time out, an error is thrown.
@@ -1357,7 +1933,7 @@ export const runtimeTypeGuards = {
1357
1933
  * @see
1358
1934
  * - {@link waitUntil.isNotBoolean} : the opposite assertion.
1359
1935
  */
1360
- isBoolean: autoGuardSymbol,
1936
+ isBoolean: createWaitUntil(assertions.isBoolean),
1361
1937
  /**
1362
1938
  * Repeatedly calls a callback until its output is a function. Once the callback output
1363
1939
  * passes, it is returned. If the attempts time out, an error is thrown.
@@ -1381,7 +1957,7 @@ export const runtimeTypeGuards = {
1381
1957
  * @see
1382
1958
  * - {@link waitUntil.isNotFunction} : the opposite assertion.
1383
1959
  */
1384
- isFunction: autoGuard(),
1960
+ isFunction: createWaitUntil(assertions.isFunction),
1385
1961
  /**
1386
1962
  * Repeatedly calls a callback until its output is exactly `null`. Once the callback output
1387
1963
  * passes, it is returned. If the attempts time out, an error is thrown.
@@ -1401,7 +1977,7 @@ export const runtimeTypeGuards = {
1401
1977
  * @see
1402
1978
  * - {@link waitUntil.isNotFunction} : the opposite assertion.
1403
1979
  */
1404
- isNull: autoGuardSymbol,
1980
+ isNull: createWaitUntil(assertions.isNull),
1405
1981
  /**
1406
1982
  * Repeatedly calls a callback until its output is a number. This excludes `NaN`. Once the
1407
1983
  * callback output passes, it is returned. If the attempts time out, an error is thrown.
@@ -1421,7 +1997,7 @@ export const runtimeTypeGuards = {
1421
1997
  * @see
1422
1998
  * - {@link waitUntil.isNotFunction} : the opposite assertion.
1423
1999
  */
1424
- isNumber: autoGuardSymbol,
2000
+ isNumber: createWaitUntil(assertions.isNumber),
1425
2001
  /**
1426
2002
  * Repeatedly calls a callback until its output is an object. This excludes arrays. Once the
1427
2003
  * callback output passes, it is returned. If the attempts time out, an error is thrown.
@@ -1443,7 +2019,7 @@ export const runtimeTypeGuards = {
1443
2019
  * @see
1444
2020
  * - {@link waitUntil.isNotFunction} : the opposite assertion.
1445
2021
  */
1446
- isObject: autoGuardSymbol,
2022
+ isObject: createWaitUntil(assertions.isObject),
1447
2023
  /**
1448
2024
  * Repeatedly calls a callback until its output is a string. Once the callback output
1449
2025
  * passes, it is returned. If the attempts time out, an error is thrown.
@@ -1463,7 +2039,7 @@ export const runtimeTypeGuards = {
1463
2039
  * @see
1464
2040
  * - {@link waitUntil.isNotFunction} : the opposite assertion.
1465
2041
  */
1466
- isString: autoGuardSymbol,
2042
+ isString: createWaitUntil(assertions.isString),
1467
2043
  /**
1468
2044
  * Repeatedly calls a callback until its output is a symbol. Once the callback output
1469
2045
  * passes, it is returned. If the attempts time out, an error is thrown.
@@ -1483,7 +2059,7 @@ export const runtimeTypeGuards = {
1483
2059
  * @see
1484
2060
  * - {@link waitUntil.isNotFunction} : the opposite assertion.
1485
2061
  */
1486
- isSymbol: autoGuardSymbol,
2062
+ isSymbol: createWaitUntil(assertions.isSymbol),
1487
2063
  /**
1488
2064
  * Repeatedly calls a callback until its output is exactly `undefined`. Once the callback
1489
2065
  * output passes, it is returned. If the attempts time out, an error is thrown.
@@ -1503,7 +2079,7 @@ export const runtimeTypeGuards = {
1503
2079
  * @see
1504
2080
  * - {@link waitUntil.isNotFunction} : the opposite assertion.
1505
2081
  */
1506
- isUndefined: autoGuardSymbol,
2082
+ isUndefined: createWaitUntil(assertions.isUndefined),
1507
2083
  /**
1508
2084
  * Repeatedly calls a callback until its output is _not_ an array. Once the callback output
1509
2085
  * passes, it is returned. If the attempts time out, an error is thrown.
@@ -1525,7 +2101,7 @@ export const runtimeTypeGuards = {
1525
2101
  * @see
1526
2102
  * - {@link waitUntil.isArray} : the opposite assertion.
1527
2103
  */
1528
- isNotArray: autoGuard(),
2104
+ isNotArray: createWaitUntil(assertions.isNotArray),
1529
2105
  /**
1530
2106
  * Repeatedly calls a callback until its output is _not_ a BigInt. Once the callback output
1531
2107
  * passes, it is returned. If the attempts time out, an error is thrown.
@@ -1545,7 +2121,7 @@ export const runtimeTypeGuards = {
1545
2121
  * @see
1546
2122
  * - {@link waitUntil.isBigInt} : the opposite assertion.
1547
2123
  */
1548
- isNotBigInt: autoGuard(),
2124
+ isNotBigInt: createWaitUntil(assertions.isNotBigInt),
1549
2125
  /**
1550
2126
  * Repeatedly calls a callback until its output is _not_ a boolean. Once the callback output
1551
2127
  * passes, it is returned. If the attempts time out, an error is thrown.
@@ -1565,7 +2141,7 @@ export const runtimeTypeGuards = {
1565
2141
  * @see
1566
2142
  * - {@link waitUntil.isBoolean} : the opposite assertion.
1567
2143
  */
1568
- isNotBoolean: autoGuard(),
2144
+ isNotBoolean: createWaitUntil(assertions.isNotBoolean),
1569
2145
  /**
1570
2146
  * Repeatedly calls a callback until its output is _not_ a function. Once the callback
1571
2147
  * output passes, it is returned. If the attempts time out, an error is thrown.
@@ -1589,7 +2165,7 @@ export const runtimeTypeGuards = {
1589
2165
  * @see
1590
2166
  * - {@link waitUntil.isFunction} : the opposite assertion.
1591
2167
  */
1592
- isNotFunction: autoGuard(),
2168
+ isNotFunction: createWaitUntil(assertions.isNotFunction),
1593
2169
  /**
1594
2170
  * Repeatedly calls a callback until its output is _not_ exactly `null`. Once the callback
1595
2171
  * output passes, it is returned. If the attempts time out, an error is thrown.
@@ -1609,7 +2185,7 @@ export const runtimeTypeGuards = {
1609
2185
  * @see
1610
2186
  * - {@link waitUntil.isFunction} : the opposite assertion.
1611
2187
  */
1612
- isNotNull: autoGuard(),
2188
+ isNotNull: createWaitUntil(assertions.isNotNull),
1613
2189
  /**
1614
2190
  * Repeatedly calls a callback until its output is _not_ a number. This includes `NaN`. Once
1615
2191
  * the callback output passes, it is returned. If the attempts time out, an error is
@@ -1630,7 +2206,7 @@ export const runtimeTypeGuards = {
1630
2206
  * @see
1631
2207
  * - {@link waitUntil.isNotFunction} : the opposite assertion.
1632
2208
  */
1633
- isNotNumber: autoGuard(),
2209
+ isNotNumber: createWaitUntil(assertions.isNotNumber),
1634
2210
  /**
1635
2211
  * Repeatedly calls a callback until its output is _not_ an object. This includes arrays.
1636
2212
  * Once the callback output passes, it is returned. If the attempts time out, an error is
@@ -1653,7 +2229,7 @@ export const runtimeTypeGuards = {
1653
2229
  * @see
1654
2230
  * - {@link waitUntil.isFunction} : the opposite assertion.
1655
2231
  */
1656
- isNotObject: autoGuard(),
2232
+ isNotObject: createWaitUntil(assertions.isNotObject),
1657
2233
  /**
1658
2234
  * Repeatedly calls a callback until its output is _not_ a string. Once the callback output
1659
2235
  * passes, it is returned. If the attempts time out, an error is thrown.
@@ -1673,7 +2249,7 @@ export const runtimeTypeGuards = {
1673
2249
  * @see
1674
2250
  * - {@link waitUntil.isFunction} : the opposite assertion.
1675
2251
  */
1676
- isNotString: autoGuard(),
2252
+ isNotString: createWaitUntil(assertions.isNotString),
1677
2253
  /**
1678
2254
  * Repeatedly calls a callback until its output is _not_ a symbol. Once the callback output
1679
2255
  * passes, it is returned. If the attempts time out, an error is thrown.
@@ -1693,7 +2269,7 @@ export const runtimeTypeGuards = {
1693
2269
  * @see
1694
2270
  * - {@link waitUntil.isFunction} : the opposite assertion.
1695
2271
  */
1696
- isNotSymbol: autoGuard(),
2272
+ isNotSymbol: createWaitUntil(assertions.isNotSymbol),
1697
2273
  /**
1698
2274
  * Repeatedly calls a callback until its output is _not_ exactly `undefined`. Once the
1699
2275
  * callback output passes, it is returned. If the attempts time out, an error is thrown.
@@ -1713,6 +2289,6 @@ export const runtimeTypeGuards = {
1713
2289
  * @see
1714
2290
  * - {@link waitUntil.isFunction} : the opposite assertion.
1715
2291
  */
1716
- isNotUndefined: autoGuard(),
2292
+ isNotUndefined: createWaitUntil(assertions.isNotUndefined),
1717
2293
  },
1718
2294
  };