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