@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,7 +1,7 @@
1
1
  import { stringify } from '@augment-vir/core';
2
2
  import deepEqual from 'deep-eql';
3
3
  import { AssertionError } from '../../augments/assertion.error.js';
4
- import { autoGuard } from '../../guard-types/guard-override.js';
4
+ import { autoGuard, autoGuardSymbol } from '../../guard-types/guard-override.js';
5
5
  export function strictEquals(actual, expected, failureMessage) {
6
6
  if (actual !== expected) {
7
7
  throw new AssertionError(`\n\n${stringify(actual)}\n\ndoes not strictly equal\n\n${stringify(expected)}\n\n`, failureMessage);
@@ -41,21 +41,727 @@ const assertions = {
41
41
  notDeepEquals,
42
42
  };
43
43
  export const simpleEqualityGuards = {
44
- assertions,
45
- checkOverrides: {
44
+ assert: assertions,
45
+ check: {
46
+ /**
47
+ * Checks that two values are strictly equal (using
48
+ * [`===`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#strict_equality_using)).
49
+ *
50
+ * Type guards the first value.
51
+ *
52
+ * @example
53
+ *
54
+ * ```ts
55
+ * import {check} from '@augment-vir/assert';
56
+ *
57
+ * check.strictEquals('a', 'a'); // true
58
+ *
59
+ * check.strictEquals('1', 1); // false
60
+ *
61
+ * check.strictEquals({a: 'a'}, {a: 'a'}); // false
62
+ *
63
+ * const objectExample = {a: 'a'};
64
+ * check.strictEquals(objectExample, objectExample); // true
65
+ * ```
66
+ *
67
+ * @see
68
+ * - {@link check.notStrictEquals} : the opposite check.
69
+ * - {@link check.looseEquals} : the loose equality check.
70
+ */
46
71
  strictEquals: autoGuard(),
72
+ /**
73
+ * Checks that two values are _not_ strictly equal (using
74
+ * [`===`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#strict_equality_using)).
75
+ *
76
+ * Performs no type guarding.
77
+ *
78
+ * @example
79
+ *
80
+ * ```ts
81
+ * import {check} from '@augment-vir/assert';
82
+ *
83
+ * check.notStrictEquals('a', 'a'); // false
84
+ *
85
+ * check.notStrictEquals('1', 1); // true
86
+ *
87
+ * check.notStrictEquals({a: 'a'}, {a: 'a'}); // true
88
+ *
89
+ * const objectExample = {a: 'a'};
90
+ * check.notStrictEquals(objectExample, objectExample); // false
91
+ * ```
92
+ *
93
+ * @see
94
+ * - {@link check.strictEquals} : the opposite check.
95
+ * - {@link check.notLooseEquals} : the loose equality check.
96
+ */
97
+ notStrictEquals: autoGuardSymbol,
98
+ /**
99
+ * Checks that two values are loosely equal (using
100
+ * [`==`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#loose_equality_using)).
101
+ *
102
+ * Type guards the first value.
103
+ *
104
+ * @example
105
+ *
106
+ * ```ts
107
+ * import {check} from '@augment-vir/assert';
108
+ *
109
+ * check.looseEquals('a', 'a'); // true
110
+ *
111
+ * check.looseEquals('1', 1); // true
112
+ *
113
+ * check.looseEquals({a: 'a'}, {a: 'a'}); // false
114
+ *
115
+ * const objectExample = {a: 'a'};
116
+ * check.looseEquals(objectExample, objectExample); // true
117
+ * ```
118
+ *
119
+ * @see
120
+ * - {@link check.notLooseEquals} : the opposite check.
121
+ * - {@link check.strictEquals} : the strict equality check.
122
+ */
123
+ looseEquals: autoGuardSymbol,
124
+ /**
125
+ * Checks that two values are _not_ loosely equal (using
126
+ * [`==`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#loose_equality_using)).
127
+ *
128
+ * Performs no type guarding.
129
+ *
130
+ * @example
131
+ *
132
+ * ```ts
133
+ * import {check} from '@augment-vir/assert';
134
+ *
135
+ * check.notLooseEquals('a', 'a'); // false
136
+ *
137
+ * check.notLooseEquals('1', 1); // false
138
+ *
139
+ * check.notLooseEquals({a: 'a'}, {a: 'a'}); // true
140
+ *
141
+ * const objectExample = {a: 'a'};
142
+ * check.notLooseEquals(objectExample, objectExample); // false
143
+ * ```
144
+ *
145
+ * @see
146
+ * - {@link check.looseEquals} : the opposite check.
147
+ * - {@link check.strictEquals} : the strict equality check.
148
+ */
149
+ notLooseEquals: autoGuardSymbol,
150
+ /**
151
+ * Checks that two values are deeply equal using the
152
+ * [deep-eql](https://www.npmjs.com/package/deep-eql) package.
153
+ *
154
+ * Note that this check may be _expensive_, depending on what values it is passed. Whenever
155
+ * possible, use simpler equality checks instead (see the **see** section below).
156
+ *
157
+ * Type guards the first value.
158
+ *
159
+ * @example
160
+ *
161
+ * ```ts
162
+ * import {check} from '@augment-vir/assert';
163
+ *
164
+ * check.deepEquals('a', 'a'); // true
165
+ *
166
+ * check.deepEquals('1', 1); // false
167
+ *
168
+ * check.deepEquals({a: 'a'}, {a: 'a'}); // true
169
+ *
170
+ * const objectExample = {a: 'a'};
171
+ * check.deepEquals(objectExample, objectExample); // true
172
+ * ```
173
+ *
174
+ * @see
175
+ * - {@link check.notDeepEquals} : the opposite check.
176
+ * - {@link check.entriesEqual} : a less expensive (but less thorough) deep equality check.
177
+ * - {@link check.jsonEquals} : a less expensive (but less thorough) deep equality check.
178
+ */
47
179
  deepEquals: autoGuard(),
180
+ /**
181
+ * Checks that two values are _not_ deeply equal using the
182
+ * [deep-eql](https://www.npmjs.com/package/deep-eql) package.
183
+ *
184
+ * Note that this check may be _expensive_, depending on what values it is passed. Whenever
185
+ * possible, use simpler equality checks instead (see the **see** section below).
186
+ *
187
+ * Type guards the first value.
188
+ *
189
+ * @example
190
+ *
191
+ * ```ts
192
+ * import {check} from '@augment-vir/assert';
193
+ *
194
+ * check.deepEquals('a', 'a'); // false
195
+ *
196
+ * check.deepEquals('1', 1); // true
197
+ *
198
+ * check.deepEquals({a: 'a'}, {a: 'a'}); // false
199
+ *
200
+ * const objectExample = {a: 'a'};
201
+ * check.deepEquals(objectExample, objectExample); // false
202
+ * ```
203
+ *
204
+ * @see
205
+ * - {@link check.notDeepEquals} : the opposite check.
206
+ * - {@link check.entriesEqual} : a less expensive (but less thorough) deep equality check.
207
+ * - {@link check.jsonEquals} : a less expensive (but less thorough) deep equality check.
208
+ */
209
+ notDeepEquals: autoGuardSymbol,
48
210
  },
49
- assertWrapOverrides: {
211
+ assertWrap: {
212
+ /**
213
+ * Asserts that two values are strictly equal (using
214
+ * [`===`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#strict_equality_using)).
215
+ * Returns the first value if the assertion passes.
216
+ *
217
+ * Type guards the first value.
218
+ *
219
+ * @example
220
+ *
221
+ * ```ts
222
+ * import {assertWrap} from '@augment-vir/assert';
223
+ *
224
+ * assertWrap.strictEquals('a', 'a'); // returns `'a'`
225
+ *
226
+ * assertWrap.strictEquals('1', 1); // throws an error
227
+ *
228
+ * assertWrap.strictEquals({a: 'a'}, {a: 'a'}); // throws an error
229
+ *
230
+ * const objectExample = {a: 'a'};
231
+ * assertWrap.strictEquals(objectExample, objectExample); // returns `{a: 'a'}`
232
+ * ```
233
+ *
234
+ * @throws {@link AssertionError} If both inputs are not strictly equal.
235
+ * @see
236
+ * - {@link assertWrap.notStrictEquals} : the opposite assertion.
237
+ * - {@link assertWrap.looseEquals} : the loose equality assertion.
238
+ */
50
239
  strictEquals: autoGuard(),
240
+ /**
241
+ * Asserts that two values are _not_ strictly equal (using
242
+ * [`===`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#strict_equality_using)).
243
+ * Returns the first value if the assertion passes.
244
+ *
245
+ * Performs no type guarding.
246
+ *
247
+ * @example
248
+ *
249
+ * ```ts
250
+ * import {assertWrap} from '@augment-vir/assert';
251
+ *
252
+ * assertWrap.notStrictEquals('a', 'a'); // throws an error
253
+ *
254
+ * assertWrap.notStrictEquals('1', 1); // returns `'1'`
255
+ *
256
+ * assertWrap.notStrictEquals({a: 'a'}, {a: 'a'}); // returns `{a: 'a'}`
257
+ *
258
+ * const objectExample = {a: 'a'};
259
+ * assertWrap.notStrictEquals(objectExample, objectExample); // throws an error
260
+ * ```
261
+ *
262
+ * @throws {@link AssertionError} If both inputs are strictly equal.
263
+ * @see
264
+ * - {@link assertWrap.strictEquals} : the opposite assertion.
265
+ * - {@link assertWrap.notLooseEquals} : the loose equality assertion.
266
+ */
267
+ notStrictEquals: autoGuardSymbol,
268
+ /**
269
+ * Asserts that two values are loosely equal (using
270
+ * [`==`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#loose_equality_using)).
271
+ * Returns the first value if the assertion passes.
272
+ *
273
+ * Type guards the first value.
274
+ *
275
+ * @example
276
+ *
277
+ * ```ts
278
+ * import {assertWrap} from '@augment-vir/assert';
279
+ *
280
+ * assertWrap.looseEquals('a', 'a'); // returns `'a'`
281
+ *
282
+ * assertWrap.looseEquals('1', 1); // returns `'1'`
283
+ *
284
+ * assertWrap.looseEquals({a: 'a'}, {a: 'a'}); // throws an error
285
+ *
286
+ * const objectExample = {a: 'a'};
287
+ * assertWrap.looseEquals(objectExample, objectExample); // returns `{a: 'a'}`
288
+ * ```
289
+ *
290
+ * @throws {@link AssertionError} If both inputs are not loosely equal.
291
+ * @see
292
+ * - {@link assertWrap.notLooseEquals} : the opposite assertion.
293
+ * - {@link assertWrap.strictEquals} : the strict equality assertion.
294
+ */
295
+ looseEquals: autoGuardSymbol,
296
+ /**
297
+ * Asserts that two values are _not_ loosely equal (using
298
+ * [`==`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#loose_equality_using)).
299
+ * Returns the first value if the assertion passes.
300
+ *
301
+ * Performs no type guarding.
302
+ *
303
+ * @example
304
+ *
305
+ * ```ts
306
+ * import {assertWrap} from '@augment-vir/assert';
307
+ *
308
+ * assertWrap.notLooseEquals('a', 'a'); // throws an error
309
+ *
310
+ * assertWrap.notLooseEquals('1', 1); // throws an error
311
+ *
312
+ * assertWrap.notLooseEquals({a: 'a'}, {a: 'a'}); // returns `{a: 'a'}`
313
+ *
314
+ * const objectExample = {a: 'a'};
315
+ * assertWrap.notLooseEquals(objectExample, objectExample); // throws an error
316
+ * ```
317
+ *
318
+ * @throws {@link AssertionError} If both inputs are loosely equal.
319
+ * @see
320
+ * - {@link assertWrap.looseEquals} : the opposite assertion.
321
+ * - {@link assertWrap.strictEquals} : the strict equality assertion.
322
+ */
323
+ notLooseEquals: autoGuardSymbol,
324
+ /**
325
+ * Asserts that two values are deeply equal using the
326
+ * [deep-eql](https://www.npmjs.com/package/deep-eql) package. Returns the first value if
327
+ * the assertion passes.
328
+ *
329
+ * Note that this check may be _expensive_, depending on what values it is passed. Whenever
330
+ * possible, use simpler equality checks instead (see the **see** section below).
331
+ *
332
+ * Type guards the first value.
333
+ *
334
+ * @example
335
+ *
336
+ * ```ts
337
+ * import {assertWrap} from '@augment-vir/assert';
338
+ *
339
+ * assertWrap.deepEquals('a', 'a'); // returns `'a'`
340
+ *
341
+ * assertWrap.deepEquals('1', 1); // throws an error
342
+ *
343
+ * assertWrap.deepEquals({a: 'a'}, {a: 'a'}); // returns `{a: 'a'}`
344
+ *
345
+ * const objectExample = {a: 'a'};
346
+ * assertWrap.deepEquals(objectExample, objectExample); // returns `{a: 'a'}`
347
+ * ```
348
+ *
349
+ * @throws {@link AssertionError} If both inputs are not deeply equal.
350
+ * @see
351
+ * - {@link assertWrap.notDeepEquals} : the opposite assertion.
352
+ * - {@link assertWrap.entriesEqual} : a less expensive (but less thorough) deep equality assertion.
353
+ * - {@link assertWrap.jsonEquals} : a less expensive (but less thorough) deep equality assertion.
354
+ */
51
355
  deepEquals: autoGuard(),
356
+ /**
357
+ * Asserts that two values are _not_ deeply equal using the
358
+ * [deep-eql](https://www.npmjs.com/package/deep-eql) package. Returns the first value if
359
+ * the assertion passes.
360
+ *
361
+ * Note that this check may be _expensive_, depending on what values it is passed. Whenever
362
+ * possible, use simpler equality checks instead (see the **see** section below).
363
+ *
364
+ * Type guards the first value.
365
+ *
366
+ * @example
367
+ *
368
+ * ```ts
369
+ * import {assertWrap} from '@augment-vir/assert';
370
+ *
371
+ * assertWrap.deepEquals('a', 'a'); // returns `'a'`
372
+ *
373
+ * assertWrap.deepEquals('1', 1); // throws an error
374
+ *
375
+ * assertWrap.deepEquals({a: 'a'}, {a: 'a'}); // returns `{a: 'a'}`
376
+ *
377
+ * const objectExample = {a: 'a'};
378
+ * assertWrap.deepEquals(objectExample, objectExample); // returns `{a: 'a'}`
379
+ * ```
380
+ *
381
+ * @throws {@link AssertionError} If both inputs are deeply equal.
382
+ * @see
383
+ * - {@link assertWrap.notDeepEquals} : the opposite assertion.
384
+ * - {@link assertWrap.entriesEqual} : a less expensive (but less thorough) deep equality assertion.
385
+ * - {@link assertWrap.jsonEquals} : a less expensive (but less thorough) deep equality assertion.
386
+ */
387
+ notDeepEquals: autoGuardSymbol,
52
388
  },
53
- checkWrapOverrides: {
389
+ checkWrap: {
390
+ /**
391
+ * Checks that two values are strictly equal (using
392
+ * [`===`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#strict_equality_using)).
393
+ * Returns the first value if the check passes, otherwise `undefined`.
394
+ *
395
+ * Type guards the first value.
396
+ *
397
+ * @example
398
+ *
399
+ * ```ts
400
+ * import {checkWrap} from '@augment-vir/assert';
401
+ *
402
+ * checkWrap.strictEquals('a', 'a'); // returns `'a'`
403
+ *
404
+ * checkWrap.strictEquals('1', 1); // returns `undefined`
405
+ *
406
+ * checkWrap.strictEquals({a: 'a'}, {a: 'a'}); // returns `undefined`
407
+ *
408
+ * const objectExample = {a: 'a'};
409
+ * checkWrap.strictEquals(objectExample, objectExample); // returns `{a: 'a'}`
410
+ * ```
411
+ *
412
+ * @returns The first value if the check passes, otherwise `undefined`.
413
+ * @see
414
+ * - {@link checkWrap.notStrictEquals} : the opposite check.
415
+ * - {@link checkWrap.looseEquals} : the loose equality check.
416
+ */
54
417
  strictEquals: autoGuard(),
418
+ /**
419
+ * Checks that two values are _not_ strictly equal (using
420
+ * [`===`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#strict_equality_using)).
421
+ * Returns the first value if the check passes, otherwise `undefined`.
422
+ *
423
+ * Performs no type guarding.
424
+ *
425
+ * @example
426
+ *
427
+ * ```ts
428
+ * import {checkWrap} from '@augment-vir/assert';
429
+ *
430
+ * checkWrap.notStrictEquals('a', 'a'); // returns `undefined`
431
+ *
432
+ * checkWrap.notStrictEquals('1', 1); // returns `'1'`
433
+ *
434
+ * checkWrap.notStrictEquals({a: 'a'}, {a: 'a'}); // returns `{a: 'a'}`
435
+ *
436
+ * const objectExample = {a: 'a'};
437
+ * checkWrap.notStrictEquals(objectExample, objectExample); // returns `undefined`
438
+ * ```
439
+ *
440
+ * @returns The first value if the check passes, otherwise `undefined`.
441
+ * @see
442
+ * - {@link checkWrap.strictEquals} : the opposite check.
443
+ * - {@link checkWrap.notLooseEquals} : the loose equality check.
444
+ */
445
+ notStrictEquals: autoGuardSymbol,
446
+ /**
447
+ * Checks that two values are loosely equal (using
448
+ * [`==`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#loose_equality_using)).
449
+ * Returns the first value if the check passes, otherwise `undefined`.
450
+ *
451
+ * Type guards the first value.
452
+ *
453
+ * @example
454
+ *
455
+ * ```ts
456
+ * import {checkWrap} from '@augment-vir/assert';
457
+ *
458
+ * checkWrap.looseEquals('a', 'a'); // returns `'a'`
459
+ *
460
+ * checkWrap.looseEquals('1', 1); // returns `'1'`
461
+ *
462
+ * checkWrap.looseEquals({a: 'a'}, {a: 'a'}); // returns `undefined`
463
+ *
464
+ * const objectExample = {a: 'a'};
465
+ * checkWrap.looseEquals(objectExample, objectExample); // returns `{a: 'a'}`
466
+ * ```
467
+ *
468
+ * @returns The first value if the check passes, otherwise `undefined`.
469
+ * @see
470
+ * - {@link checkWrap.notLooseEquals} : the opposite check.
471
+ * - {@link checkWrap.strictEquals} : the strict equality check.
472
+ */
473
+ looseEquals: autoGuardSymbol,
474
+ /**
475
+ * Checks that two values are _not_ loosely equal (using
476
+ * [`==`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#loose_equality_using)).
477
+ * Returns the first value if the check passes, otherwise `undefined`.
478
+ *
479
+ * Performs no type guarding.
480
+ *
481
+ * @example
482
+ *
483
+ * ```ts
484
+ * import {checkWrap} from '@augment-vir/assert';
485
+ *
486
+ * checkWrap.notLooseEquals('a', 'a'); // returns `undefined`
487
+ *
488
+ * checkWrap.notLooseEquals('1', 1); // returns `undefined`
489
+ *
490
+ * checkWrap.notLooseEquals({a: 'a'}, {a: 'a'}); // returns `{a: 'a'}`
491
+ *
492
+ * const objectExample = {a: 'a'};
493
+ * checkWrap.notLooseEquals(objectExample, objectExample); // returns `undefined`
494
+ * ```
495
+ *
496
+ * @returns The first value if the check passes, otherwise `undefined`.
497
+ * @see
498
+ * - {@link checkWrap.looseEquals} : the opposite check.
499
+ * - {@link checkWrap.strictEquals} : the strict equality check.
500
+ */
501
+ notLooseEquals: autoGuardSymbol,
502
+ /**
503
+ * Checks that two values are deeply equal using the
504
+ * [deep-eql](https://www.npmjs.com/package/deep-eql) package. Returns the first value if
505
+ * the check passes.
506
+ *
507
+ * Note that this check may be _expensive_, depending on what values it is passed. Whenever
508
+ * possible, use simpler equality checks instead (see the **see** section below).
509
+ *
510
+ * Type guards the first value.
511
+ *
512
+ * @example
513
+ *
514
+ * ```ts
515
+ * import {checkWrap} from '@augment-vir/assert';
516
+ *
517
+ * checkWrap.deepEquals('a', 'a'); // true
518
+ *
519
+ * checkWrap.deepEquals('1', 1); // false
520
+ *
521
+ * checkWrap.deepEquals({a: 'a'}, {a: 'a'}); // true
522
+ *
523
+ * const objectExample = {a: 'a'};
524
+ * checkWrap.deepEquals(objectExample, objectExample); // true
525
+ * ```
526
+ *
527
+ * @returns The first value if the check passes, otherwise `undefined`.
528
+ * @see
529
+ * - {@link checkWrap.notDeepEquals} : the opposite check.
530
+ * - {@link checkWrap.entriesEqual} : a less expensive (but less thorough) deep equality check.
531
+ * - {@link checkWrap.jsonEquals} : a less expensive (but less thorough) deep equality check.
532
+ */
55
533
  deepEquals: autoGuard(),
534
+ /**
535
+ * Checks that two values are _not_ deeply equal using the
536
+ * [deep-eql](https://www.npmjs.com/package/deep-eql) package. Returns the first value if
537
+ * the check passes.
538
+ *
539
+ * Note that this check may be _expensive_, depending on what values it is passed. Whenever
540
+ * possible, use simpler equality checks instead (see the **see** section below).
541
+ *
542
+ * Type guards the first value.
543
+ *
544
+ * @example
545
+ *
546
+ * ```ts
547
+ * import {checkWrap} from '@augment-vir/assert';
548
+ *
549
+ * checkWrap.deepEquals('a', 'a'); // false
550
+ *
551
+ * checkWrap.deepEquals('1', 1); // true
552
+ *
553
+ * checkWrap.deepEquals({a: 'a'}, {a: 'a'}); // false
554
+ *
555
+ * const objectExample = {a: 'a'};
556
+ * checkWrap.deepEquals(objectExample, objectExample); // false
557
+ * ```
558
+ *
559
+ * @returns The first value if the check passes, otherwise `undefined`.
560
+ * @see
561
+ * - {@link checkWrap.notDeepEquals} : the opposite check.
562
+ * - {@link checkWrap.entriesEqual} : a less expensive (but less thorough) deep equality check.
563
+ * - {@link checkWrap.jsonEquals} : a less expensive (but less thorough) deep equality check.
564
+ */
565
+ notDeepEquals: autoGuardSymbol,
56
566
  },
57
- waitUntilOverrides: {
567
+ waitUntil: {
568
+ /**
569
+ * Repeatedly calls a callback until its output strictly equals (using
570
+ * [`===`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#strict_equality_using))
571
+ * the first input. Once the callback output passes, it is returned. If the attempts time
572
+ * out, an error is thrown.
573
+ *
574
+ * Type guards the first value.
575
+ *
576
+ * @example
577
+ *
578
+ * ```ts
579
+ * import {waitUntil} from '@augment-vir/assert';
580
+ *
581
+ * await waitUntil.strictEquals('a', () => 'a'); // returns `'a'`
582
+ *
583
+ * await waitUntil.strictEquals(1, () => '1'); // throws an error
584
+ *
585
+ * await waitUntil.strictEquals({a: 'a'}, () => {
586
+ * return {a: 'a'};
587
+ * }); // throws an error
588
+ *
589
+ * const objectExample = {a: 'a'};
590
+ * await waitUntil.strictEquals(objectExample, () => objectExample); // returns `{a: 'a'}`
591
+ * ```
592
+ *
593
+ * @returns The callback output once it passes.
594
+ * @throws {@link AssertionError} On timeout.
595
+ * @see
596
+ * - {@link waitUntil.notStrictEquals} : the opposite assertion.
597
+ * - {@link waitUntil.looseEquals} : the loose equality assertion.
598
+ */
58
599
  strictEquals: autoGuard(),
600
+ /**
601
+ * Repeatedly calls a callback until its output does _not_ strictly equal (using
602
+ * [`===`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#strict_equality_using))
603
+ * the first input. Once the callback output passes, it is returned. If the attempts time
604
+ * out, an error is thrown.
605
+ *
606
+ * Performs no type guarding.
607
+ *
608
+ * @example
609
+ *
610
+ * ```ts
611
+ * import {waitUntil} from '@augment-vir/assert';
612
+ *
613
+ * await waitUntil.notStrictEquals('a', () => 'a'); // throws an error
614
+ *
615
+ * await waitUntil.notStrictEquals(1, () => '1'); // returns `'1'`
616
+ *
617
+ * await waitUntil.notStrictEquals({a: 'a'}, () => {
618
+ * return {a: 'a'};
619
+ * }); // returns `{a: 'a'}`
620
+ *
621
+ * const objectExample = {a: 'a'};
622
+ * await waitUntil.notStrictEquals(objectExample, () => objectExample); // throws an error
623
+ * ```
624
+ *
625
+ * @returns The callback output once it passes.
626
+ * @throws {@link AssertionError} On timeout.
627
+ * @see
628
+ * - {@link waitUntil.strictEquals} : the opposite assertion.
629
+ * - {@link waitUntil.notLooseEquals} : the loose equality assertion.
630
+ */
631
+ notStrictEquals: autoGuardSymbol,
632
+ /**
633
+ * Repeatedly calls a callback until its output loosely equals (using
634
+ * [`==`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#loose_equality_using))
635
+ * the first input. Once the callback output passes, it is returned. If the attempts time
636
+ * out, an error is thrown.
637
+ *
638
+ * Type guards the first value.
639
+ *
640
+ * @example
641
+ *
642
+ * ```ts
643
+ * import {waitUntil} from '@augment-vir/assert';
644
+ *
645
+ * await waitUntil.looseEquals('a', () => 'a'); // returns `'a'`
646
+ *
647
+ * await waitUntil.looseEquals(1, () => '1'); // returns `'1'`
648
+ *
649
+ * await waitUntil.looseEquals({a: 'a'}, () => {
650
+ * return {a: 'a'};
651
+ * }); // throws an error
652
+ *
653
+ * const objectExample = {a: 'a'};
654
+ * await waitUntil.looseEquals(objectExample, () => objectExample); // returns `{a: 'a'}`
655
+ * ```
656
+ *
657
+ * @returns The callback output once it passes.
658
+ * @throws {@link AssertionError} On timeout.
659
+ * @see
660
+ * - {@link waitUntil.notLooseEquals} : the opposite assertion.
661
+ * - {@link waitUntil.strictEquals} : the strict equality assertion.
662
+ */
663
+ looseEquals: autoGuardSymbol,
664
+ /**
665
+ * Repeatedly calls a callback until its output does _not_ loosely equal (using
666
+ * [`==`](https://developer.mozilla.org/docs/Web/JavaScript/Equality_comparisons_and_sameness#loose_equality_using))
667
+ * the first input. Once the callback output passes, it is returned. If the attempts time
668
+ * out, an error is thrown.
669
+ *
670
+ * Type guards the first value.
671
+ *
672
+ * @example
673
+ *
674
+ * ```ts
675
+ * import {waitUntil} from '@augment-vir/assert';
676
+ *
677
+ * await waitUntil.notLooseEquals('a', () => 'a'); // throws an error
678
+ *
679
+ * await waitUntil.notLooseEquals(1, () => '1'); // throws an error
680
+ *
681
+ * await waitUntil.notLooseEquals({a: 'a'}, () => {
682
+ * return {a: 'a'};
683
+ * }); // returns `{a: 'a'}`
684
+ *
685
+ * const objectExample = {a: 'a'};
686
+ * await waitUntil.notLooseEquals(objectExample, () => objectExample); // throws an error
687
+ * ```
688
+ *
689
+ * @returns The callback output once it passes.
690
+ * @throws {@link AssertionError} On timeout.
691
+ * @see
692
+ * - {@link waitUntil.looseEquals} : the opposite assertion.
693
+ * - {@link waitUntil.notStrictEquals} : the strict equality assertion.
694
+ */
695
+ notLooseEquals: autoGuardSymbol,
696
+ /**
697
+ * Repeatedly calls a callback until its output deeply equals (using the
698
+ * [deep-eql](https://www.npmjs.com/package/deep-eql) package) the first input. Once the
699
+ * callback output passes, it is returned. If the attempts time out, an error is thrown.
700
+ *
701
+ * Note that this check may be _expensive_, depending on what values it is passed. Whenever
702
+ * possible, use simpler equality checks instead (see the **see** section below).
703
+ *
704
+ * Type guards the first value.
705
+ *
706
+ * @example
707
+ *
708
+ * ```ts
709
+ * import {waitUntil} from '@augment-vir/assert';
710
+ *
711
+ * await waitUntil.deepEquals('a', () => 'a'); // returns `'a'`
712
+ *
713
+ * await waitUntil.deepEquals(1, () => '1'); // throws an error
714
+ *
715
+ * await waitUntil.deepEquals({a: 'a'}, () => {
716
+ * return {a: 'a'};
717
+ * }); // returns `{a: 'a'}`
718
+ *
719
+ * const objectExample = {a: 'a'};
720
+ * await waitUntil.deepEquals(objectExample, () => objectExample); // returns `{a: 'a'}`
721
+ * ```
722
+ *
723
+ * @returns The callback output once it passes.
724
+ * @throws {@link AssertionError} On timeout.
725
+ * @see
726
+ * - {@link waitUntil.notDeepEquals} : the opposite assertion.
727
+ * - {@link waitUntil.entriesEqual} : a less expensive (but less thorough) deep equality assertion.
728
+ * - {@link waitUntil.jsonEquals} : a less expensive (but less thorough) deep equality assertion.
729
+ */
59
730
  deepEquals: autoGuard(),
731
+ /**
732
+ * Repeatedly calls a callback until its output does _not_ deeply equal (using the
733
+ * [deep-eql](https://www.npmjs.com/package/deep-eql) package) the first input. Once the
734
+ * callback output passes, it is returned. If the attempts time out, an error is thrown.
735
+ *
736
+ * Note that this check may be _expensive_, depending on what values it is passed. Whenever
737
+ * possible, use simpler equality checks instead (see the **see** section below).
738
+ *
739
+ * Type guards the first value.
740
+ *
741
+ * @example
742
+ *
743
+ * ```ts
744
+ * import {waitUntil} from '@augment-vir/assert';
745
+ *
746
+ * await waitUntil.notDeepEquals('a', () => 'a'); // throws an error
747
+ *
748
+ * await waitUntil.notDeepEquals(1, () => '1'); // returns `'1'`
749
+ *
750
+ * await waitUntil.notDeepEquals({a: 'a'}, () => {
751
+ * return {a: 'a'};
752
+ * }); // throws an error
753
+ *
754
+ * const objectExample = {a: 'a'};
755
+ * await waitUntil.notDeepEquals(objectExample, () => objectExample); // throws an error
756
+ * ```
757
+ *
758
+ * @returns The callback output once it passes.
759
+ * @throws {@link AssertionError} On timeout.
760
+ * @see
761
+ * - {@link waitUntil.deepEquals} : the opposite assertion.
762
+ * - {@link waitUntil.entriesEqual} : a less expensive (but less thorough) deep equality assertion.
763
+ * - {@link waitUntil.jsonEquals} : a less expensive (but less thorough) deep equality assertion.
764
+ */
765
+ notDeepEquals: autoGuardSymbol,
60
766
  },
61
767
  };