@augment-vir/assert 30.0.0 → 30.0.1

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 (65) hide show
  1. package/README.md +11 -0
  2. package/dist/assertions/boolean.d.ts +443 -17
  3. package/dist/assertions/boolean.js +365 -8
  4. package/dist/assertions/boundary.d.ts +657 -13
  5. package/dist/assertions/boundary.js +537 -5
  6. package/dist/assertions/enum.d.ts +236 -8
  7. package/dist/assertions/enum.js +197 -5
  8. package/dist/assertions/equality/entry-equality.d.ts +287 -11
  9. package/dist/assertions/equality/entry-equality.js +243 -6
  10. package/dist/assertions/equality/json-equality.d.ts +244 -15
  11. package/dist/assertions/equality/json-equality.js +207 -11
  12. package/dist/assertions/equality/simple-equality.d.ts +849 -28
  13. package/dist/assertions/equality/simple-equality.js +712 -6
  14. package/dist/assertions/equality/ts-type-equality.d.ts +37 -1
  15. package/dist/assertions/equality/ts-type-equality.js +13 -1
  16. package/dist/assertions/extendable-assertions.d.ts +288 -120
  17. package/dist/assertions/extendable-assertions.js +32 -60
  18. package/dist/assertions/http.d.ts +217 -10
  19. package/dist/assertions/http.js +182 -6
  20. package/dist/assertions/instance.d.ts +189 -8
  21. package/dist/assertions/instance.js +159 -5
  22. package/dist/assertions/keys.d.ts +658 -13
  23. package/dist/assertions/keys.js +556 -5
  24. package/dist/assertions/length.d.ts +381 -9
  25. package/dist/assertions/length.js +309 -5
  26. package/dist/assertions/nullish.d.ts +169 -7
  27. package/dist/assertions/nullish.js +137 -6
  28. package/dist/assertions/numeric.d.ts +965 -11
  29. package/dist/assertions/numeric.js +819 -1
  30. package/dist/assertions/output.d.ts +107 -7
  31. package/dist/assertions/output.js +92 -5
  32. package/dist/assertions/primitive.d.ts +416 -13
  33. package/dist/assertions/primitive.js +352 -6
  34. package/dist/assertions/promise.d.ts +640 -21
  35. package/dist/assertions/promise.js +536 -15
  36. package/dist/assertions/regexp.d.ts +202 -3
  37. package/dist/assertions/regexp.js +173 -1
  38. package/dist/assertions/runtime-type.d.ts +1822 -41
  39. package/dist/assertions/runtime-type.js +1558 -35
  40. package/dist/assertions/throws.d.ts +265 -17
  41. package/dist/assertions/throws.js +229 -17
  42. package/dist/assertions/uuid.d.ts +233 -10
  43. package/dist/assertions/uuid.js +195 -6
  44. package/dist/assertions/values.d.ts +1086 -15
  45. package/dist/assertions/values.js +907 -6
  46. package/dist/augments/assertion.error.d.ts +2 -1
  47. package/dist/augments/assertion.error.js +2 -1
  48. package/dist/augments/guards/assert-wrap.d.ts +82 -37
  49. package/dist/augments/guards/assert-wrap.js +13 -2
  50. package/dist/augments/guards/assert.d.ts +30 -14
  51. package/dist/augments/guards/assert.js +21 -4
  52. package/dist/augments/guards/check-wrap.d.ts +94 -51
  53. package/dist/augments/guards/check-wrap.js +11 -3
  54. package/dist/augments/guards/check.d.ts +87 -37
  55. package/dist/augments/guards/check.js +9 -2
  56. package/dist/augments/guards/wait-until.d.ts +110 -103
  57. package/dist/augments/guards/wait-until.js +18 -3
  58. package/dist/augments/if-equals.d.ts +4 -2
  59. package/dist/guard-types/assert-wrap-function.d.ts +5 -2
  60. package/dist/guard-types/check-function.d.ts +5 -2
  61. package/dist/guard-types/check-wrap-wrapper-function.d.ts +4 -1
  62. package/dist/guard-types/guard-group.d.ts +7 -8
  63. package/dist/guard-types/wait-until-function.d.ts +8 -3
  64. package/dist/guard-types/wait-until-function.js +1 -1
  65. package/package.json +17 -4
@@ -1,6 +1,6 @@
1
1
  import { stringify } from '@augment-vir/core';
2
2
  import { AssertionError } from '../augments/assertion.error.js';
3
- import { autoGuard } from '../guard-types/guard-override.js';
3
+ import { autoGuard, autoGuardSymbol } from '../guard-types/guard-override.js';
4
4
  function hasValue(parent, value, failureMessage) {
5
5
  /** Wrap this in a try/catch because `Reflect.ownKeys` can fail depending on what its input is. */
6
6
  try {
@@ -85,29 +85,930 @@ const assertions = {
85
85
  isNotEmpty,
86
86
  };
87
87
  export const valueGuards = {
88
- assertions,
89
- checkOverrides: {
88
+ assert: assertions,
89
+ check: {
90
+ /**
91
+ * Checks that an object/array parent includes a child value through reference equality.
92
+ *
93
+ * Performs no type guarding.
94
+ *
95
+ * @example
96
+ *
97
+ * ```ts
98
+ * import {check} from '@augment-vir/assert';
99
+ *
100
+ * const child = {a: 'a'};
101
+ *
102
+ * check.hasValue({child}, child); // returns `true`
103
+ * check.hasValue({child: {a: 'a'}}, child); // returns `false`
104
+ * check.hasValue([child], child); // returns `true`
105
+ * ```
106
+ *
107
+ * @see
108
+ * - {@link check.lacksValue} : the opposite check.
109
+ * - {@link check.hasValues} : the multi-value check.
110
+ */
111
+ hasValue: autoGuardSymbol,
112
+ /**
113
+ * Checks that an object/array parent does _not_ include a child value through reference
114
+ * equality.
115
+ *
116
+ * Performs no type guarding.
117
+ *
118
+ * @example
119
+ *
120
+ * ```ts
121
+ * import {check} from '@augment-vir/assert';
122
+ *
123
+ * const child = {a: 'a'};
124
+ *
125
+ * check.lacksValue({child}, child); // returns `false`
126
+ * check.lacksValue({child: {a: 'a'}}, child); // returns `true`
127
+ * check.lacksValue([child], child); // returns `false`
128
+ * ```
129
+ *
130
+ * @see
131
+ * - {@link check.hasValue} : the opposite check.
132
+ * - {@link check.lacksValues} : the multi-value check.
133
+ */
134
+ lacksValue: autoGuardSymbol,
135
+ /**
136
+ * Checks that an object/array parent includes all child values through reference equality.
137
+ *
138
+ * Performs no type guarding.
139
+ *
140
+ * @example
141
+ *
142
+ * ```ts
143
+ * import {check} from '@augment-vir/assert';
144
+ *
145
+ * const child = {a: 'a'};
146
+ * const child2 = {b: 'b'};
147
+ *
148
+ * check.hasValues({child, child2}, [
149
+ * child,
150
+ * child2,
151
+ * ]); // returns `true`
152
+ * check.hasValues({child: {a: 'a'}, child2}, [
153
+ * child,
154
+ * child2,
155
+ * ]); // returns `false`
156
+ * check.hasValues(
157
+ * [child],
158
+ * [
159
+ * child,
160
+ * child2,
161
+ * ],
162
+ * ); // returns `true`
163
+ * ```
164
+ *
165
+ * @see
166
+ * - {@link check.lacksValues} : the opposite check.
167
+ * - {@link check.hasValue} : the single-value check.
168
+ */
169
+ hasValues: autoGuardSymbol,
170
+ /**
171
+ * Checks that an object/array parent includes none of the provided child values through
172
+ * reference equality.
173
+ *
174
+ * Performs no type guarding.
175
+ *
176
+ * @example
177
+ *
178
+ * ```ts
179
+ * import {check} from '@augment-vir/assert';
180
+ *
181
+ * const child = {a: 'a'};
182
+ * const child2 = {b: 'b'};
183
+ *
184
+ * check.lacksValues({}, [
185
+ * child,
186
+ * child2,
187
+ * ]); // returns `true`
188
+ * check.lacksValues({child, child2}, [
189
+ * child,
190
+ * child2,
191
+ * ]); // returns `false`
192
+ * check.lacksValues({child: {a: 'a'}, child2}, [
193
+ * child,
194
+ * child2,
195
+ * ]); // returns `false`
196
+ * ```
197
+ *
198
+ * @see
199
+ * - {@link check.lacksValues} : the opposite check.
200
+ * - {@link check.hasValue} : the single-value check.
201
+ */
202
+ lacksValues: autoGuardSymbol,
203
+ /**
204
+ * Checks that child value is contained within a parent object, array, or string through
205
+ * reference equality.
206
+ *
207
+ * Type guards the child when possible.
208
+ *
209
+ * @example
210
+ *
211
+ * ```ts
212
+ * import {check} from '@augment-vir/assert';
213
+ *
214
+ * const child = {a: 'a'};
215
+ *
216
+ * check.isIn(child, {child}); // returns `true`
217
+ * check.isIn('a', 'ab'); // returns `true`
218
+ * check.isIn(child, [child]); // returns `true`
219
+ *
220
+ * check.isIn(child, {child: {a: 'a'}}); // returns `false`
221
+ * check.isIn('a', 'bc'); // returns `false`
222
+ * ```
223
+ *
224
+ * @see
225
+ * - {@link check.isNotIn} : the opposite check.
226
+ */
90
227
  isIn: autoGuard(),
228
+ /**
229
+ * Checks that child value is _not_ contained within a parent object, array, or string
230
+ * through reference equality.
231
+ *
232
+ * Type guards the child when possible.
233
+ *
234
+ * @example
235
+ *
236
+ * ```ts
237
+ * import {check} from '@augment-vir/assert';
238
+ *
239
+ * const child = {a: 'a'};
240
+ *
241
+ * check.isNotIn(child, {child}); // returns `false`
242
+ * check.isNotIn('a', 'ab'); // returns `false`
243
+ * check.isNotIn(child, [child]); // returns `false`
244
+ *
245
+ * check.isNotIn(child, {child: {a: 'a'}}); // returns `true`
246
+ * check.isNotIn('a', 'bc'); // returns `true`
247
+ * ```
248
+ *
249
+ * @see
250
+ * - {@link check.isIn} : the opposite check.
251
+ */
91
252
  isNotIn: autoGuard(),
253
+ /**
254
+ * Checks that a value is empty. Supports strings, Maps, Sets, objects, and arrays.
255
+ *
256
+ * Type guards the value.
257
+ *
258
+ * @example
259
+ *
260
+ * ```ts
261
+ * import {check} from '@augment-vir/assert';
262
+ *
263
+ * check.isEmpty({}); // returns `true`
264
+ * check.isEmpty(''); // returns `true`
265
+ * check.isEmpty([]); // returns `true`
266
+ *
267
+ * check.isEmpty('a'); // returns `false`
268
+ * check.isEmpty({a: 'a'}); // returns `false`
269
+ * ```
270
+ *
271
+ * @see
272
+ * - {@link check.isNotEmpty} : the opposite check.
273
+ */
92
274
  isEmpty: autoGuard(),
275
+ /**
276
+ * Checks that a value is _not_ empty. Supports strings, Maps, Sets, objects, and arrays.
277
+ *
278
+ * Type guards the value.
279
+ *
280
+ * @example
281
+ *
282
+ * ```ts
283
+ * import {check} from '@augment-vir/assert';
284
+ *
285
+ * check.isNotEmpty({}); // returns `false`
286
+ * check.isNotEmpty(''); // returns `false`
287
+ * check.isNotEmpty([]); // returns `false`
288
+ *
289
+ * check.isNotEmpty('a'); // returns `true`
290
+ * check.isNotEmpty({a: 'a'}); // returns `true`
291
+ * ```
292
+ *
293
+ * @see
294
+ * - {@link check.isEmpty} : the opposite check.
295
+ */
93
296
  isNotEmpty: autoGuard(),
94
297
  },
95
- assertWrapOverrides: {
298
+ assertWrap: {
299
+ /**
300
+ * Asserts that an object/array parent includes a child value through reference equality.
301
+ * Returns the parent value if the assertion passes.
302
+ *
303
+ * Performs no type guarding.
304
+ *
305
+ * @example
306
+ *
307
+ * ```ts
308
+ * import {assertWrap} from '@augment-vir/assert';
309
+ *
310
+ * const child = {a: 'a'};
311
+ *
312
+ * assertWrap.hasValue({child}, child); // returns `{child}`;
313
+ * assertWrap.hasValue({child: {a: 'a'}}, child); // throws an error
314
+ * assertWrap.hasValue([child], child); // returns `[child]`;
315
+ * ```
316
+ *
317
+ * @returns The value if the assertion passes.
318
+ * @throws {@link AssertionError} If the assertion fails.
319
+ * @see
320
+ * - {@link assertWrap.lacksValue} : the opposite assertion.
321
+ * - {@link assertWrap.hasValues} : the multi-value assertion.
322
+ */
323
+ hasValue: autoGuardSymbol,
324
+ /**
325
+ * Asserts that an object/array parent does _not_ include a child value through reference
326
+ * equality. Returns the parent value if the assertion passes.
327
+ *
328
+ * Performs no type guarding.
329
+ *
330
+ * @example
331
+ *
332
+ * ```ts
333
+ * import {assertWrap} from '@augment-vir/assert';
334
+ *
335
+ * const child = {a: 'a'};
336
+ *
337
+ * assertWrap.lacksValue({child}, child); // throws an error
338
+ * assertWrap.lacksValue({child: {a: 'a'}}, child); // returns `{child: {a: 'a'}}`;
339
+ * assertWrap.lacksValue([child], child); // throws an error
340
+ * ```
341
+ *
342
+ * @returns The value if the assertion passes.
343
+ * @throws {@link AssertionError} If the assertion fails.
344
+ * @see
345
+ * - {@link assertWrap.hasValue} : the opposite assertion.
346
+ * - {@link assertWrap.lacksValues} : the multi-value assertion.
347
+ */
348
+ lacksValue: autoGuardSymbol,
349
+ /**
350
+ * Asserts that an object/array parent includes all child values through reference equality.
351
+ * Returns the parent value if the assertion passes.
352
+ *
353
+ * Performs no type guarding.
354
+ *
355
+ * @example
356
+ *
357
+ * ```ts
358
+ * import {assertWrap} from '@augment-vir/assert';
359
+ *
360
+ * const child = {a: 'a'};
361
+ * const child2 = {b: 'b'};
362
+ *
363
+ * assertWrap.hasValues({child, child2}, [
364
+ * child,
365
+ * child2,
366
+ * ]); // returns `{child, child2}`;
367
+ * assertWrap.hasValues({child: {a: 'a'}, child2}, [
368
+ * child,
369
+ * child2,
370
+ * ]); // throws an error
371
+ * assertWrap.hasValues(
372
+ * [child],
373
+ * [
374
+ * child,
375
+ * child2,
376
+ * ],
377
+ * ); // returns `[child]`;
378
+ * ```
379
+ *
380
+ * @returns The value if the assertion passes.
381
+ * @throws {@link AssertionError} If the assertion fails.
382
+ * @see
383
+ * - {@link assertWrap.lacksValues} : the opposite assertion.
384
+ * - {@link assertWrap.hasValue} : the single-value assertion.
385
+ */
386
+ hasValues: autoGuardSymbol,
387
+ /**
388
+ * Asserts that an object/array parent includes none of the provided child values through
389
+ * reference equality. Returns the parent value if the assertion passes.
390
+ *
391
+ * Performs no type guarding.
392
+ *
393
+ * @example
394
+ *
395
+ * ```ts
396
+ * import {assertWrap} from '@augment-vir/assert';
397
+ *
398
+ * const child = {a: 'a'};
399
+ * const child2 = {b: 'b'};
400
+ *
401
+ * assertWrap.lacksValues({}, [
402
+ * child,
403
+ * child2,
404
+ * ]); // returns `{}`;
405
+ * assertWrap.lacksValues({child, child2}, [
406
+ * child,
407
+ * child2,
408
+ * ]); // throws an error
409
+ * assertWrap.lacksValues({child: {a: 'a'}, child2}, [
410
+ * child,
411
+ * child2,
412
+ * ]); // throws an error
413
+ * ```
414
+ *
415
+ * @returns The value if the assertion passes.
416
+ * @throws {@link AssertionError} If the assertion fails.
417
+ * @see
418
+ * - {@link assertWrap.lacksValues} : the opposite assertion.
419
+ * - {@link assertWrap.hasValue} : the single-value assertion.
420
+ */
421
+ lacksValues: autoGuardSymbol,
422
+ /**
423
+ * Asserts that child value is contained within a parent object, array, or string through
424
+ * reference equality. Returns the child value if the assertion passes.
425
+ *
426
+ * Type guards the child when possible.
427
+ *
428
+ * @example
429
+ *
430
+ * ```ts
431
+ * import {assertWrap} from '@augment-vir/assert';
432
+ *
433
+ * const child = {a: 'a'};
434
+ *
435
+ * assertWrap.isIn(child, {child}); // returns `child`;
436
+ * assertWrap.isIn('a', 'ab'); // returns `'a'`;
437
+ * assertWrap.isIn(child, [child]); // returns `child`;
438
+ *
439
+ * assertWrap.isIn(child, {child: {a: 'a'}}); // throws an error
440
+ * assertWrap.isIn('a', 'bc'); // throws an error
441
+ * ```
442
+ *
443
+ * @returns The value if the assertion passes.
444
+ * @throws {@link AssertionError} If the assertion fails.
445
+ * @see
446
+ * - {@link assertWrap.isNotIn} : the opposite assertion.
447
+ */
96
448
  isIn: autoGuard(),
449
+ /**
450
+ * Asserts that child value is _not_ contained within a parent object, array, or string
451
+ * through reference equality. Returns the child value if the assertion passes.
452
+ *
453
+ * Type guards the child when possible.
454
+ *
455
+ * @example
456
+ *
457
+ * ```ts
458
+ * import {assertWrap} from '@augment-vir/assert';
459
+ *
460
+ * const child = {a: 'a'};
461
+ *
462
+ * assertWrap.isNotIn(child, {child}); // throws an error
463
+ * assertWrap.isNotIn('a', 'ab'); // throws an error
464
+ * assertWrap.isNotIn(child, [child]); // throws an error
465
+ *
466
+ * assertWrap.isNotIn(child, {child: {a: 'a'}}); // returns `child`;
467
+ * assertWrap.isNotIn('a', 'bc'); // returns `'a'`;
468
+ * ```
469
+ *
470
+ * @returns The value if the assertion passes.
471
+ * @throws {@link AssertionError} If the assertion fails.
472
+ * @see
473
+ * - {@link assertWrap.isIn} : the opposite assertion.
474
+ */
97
475
  isNotIn: autoGuard(),
476
+ /**
477
+ * Asserts that a value is empty. Supports strings, Maps, Sets, objects, and arrays. Returns
478
+ * the value if the assertion passes.
479
+ *
480
+ * Type guards the value.
481
+ *
482
+ * @example
483
+ *
484
+ * ```ts
485
+ * import {assertWrap} from '@augment-vir/assert';
486
+ *
487
+ * assertWrap.isEmpty({}); // returns `{}`;
488
+ * assertWrap.isEmpty(''); // returns `''`;
489
+ * assertWrap.isEmpty([]); // returns `[]`;
490
+ *
491
+ * assertWrap.isEmpty('a'); // throws an error
492
+ * assertWrap.isEmpty({a: 'a'}); // throws an error
493
+ * ```
494
+ *
495
+ * @returns The value if the assertion passes.
496
+ * @throws {@link AssertionError} If the assertion fails.
497
+ * @see
498
+ * - {@link assertWrap.isNotEmpty} : the opposite assertion.
499
+ */
98
500
  isEmpty: autoGuard(),
501
+ /**
502
+ * Asserts that a value is _not_ empty. Supports strings, Maps, Sets, objects, and arrays.
503
+ * Returns the value if the assertion passes.
504
+ *
505
+ * Type guards the value.
506
+ *
507
+ * @example
508
+ *
509
+ * ```ts
510
+ * import {assertWrap} from '@augment-vir/assert';
511
+ *
512
+ * assertWrap.isNotEmpty({}); // throws an error
513
+ * assertWrap.isNotEmpty(''); // throws an error
514
+ * assertWrap.isNotEmpty([]); // throws an error
515
+ *
516
+ * assertWrap.isNotEmpty('a'); // returns `'a'`;
517
+ * assertWrap.isNotEmpty({a: 'a'}); // returns `{a: 'a'}`;
518
+ * ```
519
+ *
520
+ * @returns The value if the assertion passes.
521
+ * @throws {@link AssertionError} If the assertion fails.
522
+ * @see
523
+ * - {@link assertWrap.isEmpty} : the opposite assertion.
524
+ */
99
525
  isNotEmpty: autoGuard(),
100
526
  },
101
- checkWrapOverrides: {
527
+ checkWrap: {
528
+ /**
529
+ * Checks that an object/array parent includes a child value through reference equality.
530
+ *
531
+ * Performs no type guarding.
532
+ *
533
+ * @example
534
+ *
535
+ * ```ts
536
+ * import {checkWrap} from '@augment-vir/assert';
537
+ *
538
+ * const child = {a: 'a'};
539
+ *
540
+ * checkWrap.hasValue({child}, child); // returns `{child}`
541
+ * checkWrap.hasValue({child: {a: 'a'}}, child); // returns `undefined`
542
+ * checkWrap.hasValue([child], child); // returns `[child]`
543
+ * ```
544
+ *
545
+ * @see
546
+ * - {@link checkWrap.lacksValue} : the opposite check.
547
+ * - {@link checkWrap.hasValues} : the multi-value check.
548
+ */
549
+ hasValue: autoGuardSymbol,
550
+ /**
551
+ * Checks that an object/array parent does _not_ include a child value through reference
552
+ * equality.
553
+ *
554
+ * Performs no type guarding.
555
+ *
556
+ * @example
557
+ *
558
+ * ```ts
559
+ * import {checkWrap} from '@augment-vir/assert';
560
+ *
561
+ * const child = {a: 'a'};
562
+ *
563
+ * checkWrap.lacksValue({child}, child); // returns `undefined`
564
+ * checkWrap.lacksValue({child: {a: 'a'}}, child); // returns `{child: {a: 'a'}}`
565
+ * checkWrap.lacksValue([child], child); // returns `undefined`
566
+ * ```
567
+ *
568
+ * @see
569
+ * - {@link checkWrap.hasValue} : the opposite check.
570
+ * - {@link checkWrap.lacksValues} : the multi-value check.
571
+ */
572
+ lacksValue: autoGuardSymbol,
573
+ /**
574
+ * Checks that an object/array parent includes all child values through reference equality.
575
+ *
576
+ * Performs no type guarding.
577
+ *
578
+ * @example
579
+ *
580
+ * ```ts
581
+ * import {checkWrap} from '@augment-vir/assert';
582
+ *
583
+ * const child = {a: 'a'};
584
+ * const child2 = {b: 'b'};
585
+ *
586
+ * checkWrap.hasValues({child, child2}, [
587
+ * child,
588
+ * child2,
589
+ * ]); // returns `{child, child2}`
590
+ * checkWrap.hasValues({child: {a: 'a'}, child2}, [
591
+ * child,
592
+ * child2,
593
+ * ]); // returns `undefined`
594
+ * checkWrap.hasValues(
595
+ * [child],
596
+ * [
597
+ * child,
598
+ * child2,
599
+ * ],
600
+ * ); // returns `[child]`
601
+ * ```
602
+ *
603
+ * @see
604
+ * - {@link checkWrap.lacksValues} : the opposite check.
605
+ * - {@link checkWrap.hasValue} : the single-value check.
606
+ */
607
+ hasValues: autoGuardSymbol,
608
+ /**
609
+ * Checks that an object/array parent includes none of the provided child values through
610
+ * reference equality.
611
+ *
612
+ * Performs no type guarding.
613
+ *
614
+ * @example
615
+ *
616
+ * ```ts
617
+ * import {checkWrap} from '@augment-vir/assert';
618
+ *
619
+ * const child = {a: 'a'};
620
+ * const child2 = {b: 'b'};
621
+ *
622
+ * checkWrap.lacksValues({}, [
623
+ * child,
624
+ * child2,
625
+ * ]); // returns `{}`
626
+ * checkWrap.lacksValues({child, child2}, [
627
+ * child,
628
+ * child2,
629
+ * ]); // returns `undefined`
630
+ * checkWrap.lacksValues({child: {a: 'a'}, child2}, [
631
+ * child,
632
+ * child2,
633
+ * ]); // returns `undefined`
634
+ * ```
635
+ *
636
+ * @see
637
+ * - {@link checkWrap.lacksValues} : the opposite check.
638
+ * - {@link checkWrap.hasValue} : the single-value check.
639
+ */
640
+ lacksValues: autoGuardSymbol,
641
+ /**
642
+ * Checks that child value is contained within a parent object, array, or string through
643
+ * reference equality.
644
+ *
645
+ * Type guards the child when possible.
646
+ *
647
+ * @example
648
+ *
649
+ * ```ts
650
+ * import {checkWrap} from '@augment-vir/assert';
651
+ *
652
+ * const child = {a: 'a'};
653
+ *
654
+ * checkWrap.isIn(child, {child}); // returns `child`
655
+ * checkWrap.isIn('a', 'ab'); // returns `'a'`
656
+ * checkWrap.isIn(child, [child]); // returns `child`
657
+ *
658
+ * checkWrap.isIn(child, {child: {a: 'a'}}); // returns `undefined`
659
+ * checkWrap.isIn('a', 'bc'); // returns `undefined`
660
+ * ```
661
+ *
662
+ * @see
663
+ * - {@link checkWrap.isNotIn} : the opposite check.
664
+ */
102
665
  isIn: autoGuard(),
666
+ /**
667
+ * Checks that child value is _not_ contained within a parent object, array, or string
668
+ * through reference equality.
669
+ *
670
+ * Type guards the child when possible.
671
+ *
672
+ * @example
673
+ *
674
+ * ```ts
675
+ * import {checkWrap} from '@augment-vir/assert';
676
+ *
677
+ * const child = {a: 'a'};
678
+ *
679
+ * checkWrap.isNotIn(child, {child}); // returns `undefined`
680
+ * checkWrap.isNotIn('a', 'ab'); // returns `undefined`
681
+ * checkWrap.isNotIn(child, [child]); // returns `undefined`
682
+ *
683
+ * checkWrap.isNotIn(child, {child: {a: 'a'}}); // returns `child`
684
+ * checkWrap.isNotIn('a', 'bc'); // returns `'a'`
685
+ * ```
686
+ *
687
+ * @see
688
+ * - {@link checkWrap.isIn} : the opposite check.
689
+ */
103
690
  isNotIn: autoGuard(),
691
+ /**
692
+ * Checks that a value is empty. Supports strings, Maps, Sets, objects, and arrays.
693
+ *
694
+ * Type guards the value.
695
+ *
696
+ * @example
697
+ *
698
+ * ```ts
699
+ * import {checkWrap} from '@augment-vir/assert';
700
+ *
701
+ * checkWrap.isEmpty({}); // returns `{}`
702
+ * checkWrap.isEmpty(''); // returns `''`
703
+ * checkWrap.isEmpty([]); // returns `[]`
704
+ *
705
+ * checkWrap.isEmpty('a'); // returns `undefined`
706
+ * checkWrap.isEmpty({a: 'a'}); // returns `undefined`
707
+ * ```
708
+ *
709
+ * @see
710
+ * - {@link checkWrap.isNotEmpty} : the opposite check.
711
+ */
104
712
  isEmpty: autoGuard(),
713
+ /**
714
+ * Checks that a value is _not_ empty. Supports strings, Maps, Sets, objects, and arrays.
715
+ *
716
+ * Type guards the value.
717
+ *
718
+ * @example
719
+ *
720
+ * ```ts
721
+ * import {checkWrap} from '@augment-vir/assert';
722
+ *
723
+ * checkWrap.isNotEmpty({}); // returns `undefined`
724
+ * checkWrap.isNotEmpty(''); // returns `undefined`
725
+ * checkWrap.isNotEmpty([]); // returns `undefined`
726
+ *
727
+ * checkWrap.isNotEmpty('a'); // returns `'a'`
728
+ * checkWrap.isNotEmpty({a: 'a'}); // returns `{a: 'a'}`
729
+ * ```
730
+ *
731
+ * @see
732
+ * - {@link checkWrap.isEmpty} : the opposite check.
733
+ */
105
734
  isNotEmpty: autoGuard(),
106
735
  },
107
- waitUntilOverrides: {
736
+ waitUntil: {
737
+ /**
738
+ * Repeatedly calls a callback until its output is an object/array parent includes a child
739
+ * value through reference equality. Once the callback output passes, it is returned. If the
740
+ * attempts time out, an error is thrown.
741
+ *
742
+ * Performs no type guarding.
743
+ *
744
+ * @example
745
+ *
746
+ * ```ts
747
+ * import {waitUntil} from '@augment-vir/assert';
748
+ *
749
+ * const child = {a: 'a'};
750
+ *
751
+ * await waitUntil.hasValue(child, () => {
752
+ * return {child};
753
+ * }); // returns `{child}`;
754
+ * await waitUntil.hasValue(child, () => {
755
+ * return {child: {a: 'a'}};
756
+ * }); // throws an error
757
+ * await waitUntil.hasValue(child, () => [child]); // returns `[child]`;
758
+ * ```
759
+ *
760
+ * @returns The callback output once it passes.
761
+ * @throws {@link AssertionError} On timeout.
762
+ * @see
763
+ * - {@link waitUntil.lacksValue} : the opposite assertion.
764
+ * - {@link waitUntil.hasValues} : the multi-value assertion.
765
+ */
766
+ hasValue: autoGuardSymbol,
767
+ /**
768
+ * Repeatedly calls a callback until its output is an object/array parent does _not_ include
769
+ * a child value through reference equality. Once the callback output passes, it is
770
+ * returned. If the attempts time out, an error is thrown.
771
+ *
772
+ * Performs no type guarding.
773
+ *
774
+ * @example
775
+ *
776
+ * ```ts
777
+ * import {waitUntil} from '@augment-vir/assert';
778
+ *
779
+ * const child = {a: 'a'};
780
+ *
781
+ * await waitUntil.lacksValue(child, () => {
782
+ * return {child};
783
+ * }); // throws an error
784
+ * await waitUntil.lacksValue(child, () => {
785
+ * return {child: {a: 'a'}};
786
+ * }); // returns `{child: {a: 'a'}}`;
787
+ * await waitUntil.lacksValue(child, () => [child]); // throws an error
788
+ * ```
789
+ *
790
+ * @returns The callback output once it passes.
791
+ * @throws {@link AssertionError} On timeout.
792
+ * @see
793
+ * - {@link waitUntil.hasValue} : the opposite assertion.
794
+ * - {@link waitUntil.lacksValues} : the multi-value assertion.
795
+ */
796
+ lacksValue: autoGuardSymbol,
797
+ /**
798
+ * Repeatedly calls a callback until its output is an object/array parent includes all child
799
+ * values through reference equality. Once the callback output passes, it is returned. If
800
+ * the attempts time out, an error is thrown.
801
+ *
802
+ * Performs no type guarding.
803
+ *
804
+ * @example
805
+ *
806
+ * ```ts
807
+ * import {waitUntil} from '@augment-vir/assert';
808
+ *
809
+ * const child = {a: 'a'};
810
+ * const child2 = {b: 'b'};
811
+ *
812
+ * await waitUntil.hasValues(
813
+ * [
814
+ * child,
815
+ * child2,
816
+ * ],
817
+ * () => {
818
+ * return {child, child2};
819
+ * },
820
+ * ); // returns `{child, child2}`;
821
+ * await waitUntil.hasValues(
822
+ * [
823
+ * child,
824
+ * child2,
825
+ * ],
826
+ * () => {
827
+ * return {child: {a: 'a'}, child2};
828
+ * },
829
+ * ); // throws an error
830
+ * await waitUntil.hasValues(
831
+ * [
832
+ * child,
833
+ * child2,
834
+ * ],
835
+ * () => [child],
836
+ * ); // returns `[child]`;
837
+ * ```
838
+ *
839
+ * @returns The callback output once it passes.
840
+ * @throws {@link AssertionError} On timeout.
841
+ * @see
842
+ * - {@link waitUntil.lacksValues} : the opposite assertion.
843
+ * - {@link waitUntil.hasValue} : the single-value assertion.
844
+ */
845
+ hasValues: autoGuardSymbol,
846
+ /**
847
+ * Repeatedly calls a callback until its output is an object/array parent includes none of
848
+ * the provided child values through reference equality. Once the callback output passes, it
849
+ * is returned. If the attempts time out, an error is thrown.
850
+ *
851
+ * Performs no type guarding.
852
+ *
853
+ * @example
854
+ *
855
+ * ```ts
856
+ * import {waitUntil} from '@augment-vir/assert';
857
+ *
858
+ * const child = {a: 'a'};
859
+ * const child2 = {b: 'b'};
860
+ *
861
+ * await waitUntil.lacksValues(
862
+ * [
863
+ * child,
864
+ * child2,
865
+ * ],
866
+ * () => {
867
+ * return {};
868
+ * },
869
+ * ); // returns `{}`;
870
+ * await waitUntil.lacksValues(
871
+ * [
872
+ * child,
873
+ * child2,
874
+ * ],
875
+ * () => {
876
+ * return {child, child2};
877
+ * },
878
+ * ); // throws an error
879
+ * await waitUntil.lacksValues(
880
+ * [
881
+ * child,
882
+ * child2,
883
+ * ],
884
+ * () => {
885
+ * return {child: {a: 'a'}, child2};
886
+ * },
887
+ * ); // throws an error
888
+ * ```
889
+ *
890
+ * @returns The callback output once it passes.
891
+ * @throws {@link AssertionError} On timeout.
892
+ * @see
893
+ * - {@link waitUntil.lacksValues} : the opposite assertion.
894
+ * - {@link waitUntil.hasValue} : the single-value assertion.
895
+ */
896
+ lacksValues: autoGuardSymbol,
897
+ /**
898
+ * Repeatedly calls a callback until its output is child value is contained within a parent
899
+ * object, array, or string through reference equality. Once the callback output passes, it
900
+ * is returned. If the attempts time out, an error is thrown.
901
+ *
902
+ * Type guards the child when possible.
903
+ *
904
+ * @example
905
+ *
906
+ * ```ts
907
+ * import {waitUntil} from '@augment-vir/assert';
908
+ *
909
+ * const child = {a: 'a'};
910
+ *
911
+ * await waitUntil.isIn({child}, () => child); // returns `child`
912
+ * await waitUntil.isIn('ab', () => 'a'); // returns `'a'`
913
+ * await waitUntil.isIn(child, () => [child]); // returns `child`
914
+ *
915
+ * await waitUntil.isIn({child: {a: 'a'}}, () => child); // throws an error
916
+ * await waitUntil.isIn('bc', () => 'a'); // throws an error
917
+ * ```
918
+ *
919
+ * @returns The callback output once it passes.
920
+ * @throws {@link AssertionError} On timeout.
921
+ * @see
922
+ * - {@link waitUntil.isNotIn} : the opposite assertion.
923
+ */
108
924
  isIn: autoGuard(),
925
+ /**
926
+ * Repeatedly calls a callback until its output is child value is _not_ contained within a
927
+ * parent object, array, or string through reference equality. Once the callback output
928
+ * passes, it is returned. If the attempts time out, an error is thrown.
929
+ *
930
+ * Type guards the child when possible.
931
+ *
932
+ * @example
933
+ *
934
+ * ```ts
935
+ * import {waitUntil} from '@augment-vir/assert';
936
+ *
937
+ * const child = {a: 'a'};
938
+ *
939
+ * await waitUntil.isNotIn({child}, () => child); // throws an error
940
+ * await waitUntil.isNotIn('ab', () => 'a'); // throws an error
941
+ * await waitUntil.isNotIn([child], () => child); // throws an error
942
+ *
943
+ * await waitUntil.isNotIn({child: {a: 'a'}}, () => child); // returns `child`;
944
+ * await waitUntil.isNotIn('bc', () => 'a'); // returns `'a'`;
945
+ * ```
946
+ *
947
+ * @returns The callback output once it passes.
948
+ * @throws {@link AssertionError} On timeout.
949
+ * @see
950
+ * - {@link waitUntil.isIn} : the opposite assertion.
951
+ */
109
952
  isNotIn: autoGuard(),
953
+ /**
954
+ * Repeatedly calls a callback until its output is a value is empty. Supports strings, Maps,
955
+ * Sets, objects, and arrays. Once the callback output passes, it is returned. If the
956
+ * attempts time out, an error is thrown.
957
+ *
958
+ * Type guards the value.
959
+ *
960
+ * @example
961
+ *
962
+ * ```ts
963
+ * import {waitUntil} from '@augment-vir/assert';
964
+ *
965
+ * await waitUntil.isEmpty(() => {
966
+ * return {};
967
+ * }); // returns `{}`;
968
+ * await waitUntil.isEmpty(() => ''); // returns `''`;
969
+ * await waitUntil.isEmpty(() => []); // returns `[]`;
970
+ *
971
+ * await waitUntil.isEmpty(() => 'a'); // throws an error
972
+ * await waitUntil.isEmpty(() => {
973
+ * return {a: 'a'};
974
+ * }); // throws an error
975
+ * ```
976
+ *
977
+ * @returns The callback output once it passes.
978
+ * @throws {@link AssertionError} On timeout.
979
+ * @see
980
+ * - {@link waitUntil.isNotEmpty} : the opposite assertion.
981
+ */
110
982
  isEmpty: autoGuard(),
983
+ /**
984
+ * Repeatedly calls a callback until its output is a value is _not_ empty. Supports strings,
985
+ * Maps, Sets, objects, and arrays. Once the callback output passes, it is returned. If the
986
+ * attempts time out, an error is thrown.
987
+ *
988
+ * Type guards the value.
989
+ *
990
+ * @example
991
+ *
992
+ * ```ts
993
+ * import {waitUntil} from '@augment-vir/assert';
994
+ *
995
+ * await waitUntil.isNotEmpty(() => {
996
+ * return {};
997
+ * }); // throws an error
998
+ * await waitUntil.isNotEmpty(() => ''); // throws an error
999
+ * await waitUntil.isNotEmpty(() => []); // throws an error
1000
+ *
1001
+ * await waitUntil.isNotEmpty(() => 'a'); // returns `'a'`;
1002
+ * await waitUntil.isNotEmpty(() => {
1003
+ * return {a: 'a'};
1004
+ * }); // returns `{a: 'a'}`;
1005
+ * ```
1006
+ *
1007
+ * @returns The callback output once it passes.
1008
+ * @throws {@link AssertionError} On timeout.
1009
+ * @see
1010
+ * - {@link waitUntil.isEmpty} : the opposite assertion.
1011
+ */
111
1012
  isNotEmpty: autoGuard(),
112
1013
  },
113
1014
  };