@augment-vir/assert 30.8.4 → 31.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.
- package/dist/assertions/boolean.d.ts +20 -26
- package/dist/assertions/boolean.js +185 -41
- package/dist/assertions/boundary.d.ts +40 -256
- package/dist/assertions/boundary.js +265 -229
- package/dist/assertions/enum.d.ts +12 -13
- package/dist/assertions/enum.js +98 -20
- package/dist/assertions/equality/entry-equality.d.ts +11 -15
- package/dist/assertions/equality/entry-equality.js +210 -43
- package/dist/assertions/equality/json-equality.d.ts +11 -15
- package/dist/assertions/equality/json-equality.js +144 -43
- package/dist/assertions/equality/simple-equality.d.ts +39 -46
- package/dist/assertions/equality/simple-equality.js +316 -61
- package/dist/assertions/extendable-assertions.d.ts +0 -12
- package/dist/assertions/extendable-assertions.js +0 -12
- package/dist/assertions/http.d.ts +10 -14
- package/dist/assertions/http.js +96 -28
- package/dist/assertions/instance.d.ts +10 -18
- package/dist/assertions/instance.js +92 -26
- package/dist/assertions/keys.d.ts +59 -138
- package/dist/assertions/keys.js +279 -163
- package/dist/assertions/length.d.ts +30 -212
- package/dist/assertions/length.js +117 -175
- package/dist/assertions/nullish.d.ts +8 -20
- package/dist/assertions/nullish.js +85 -27
- package/dist/assertions/numeric.d.ts +67 -81
- package/dist/assertions/numeric.js +564 -133
- package/dist/assertions/output.d.ts +2 -3
- package/dist/assertions/output.js +1 -7
- package/dist/assertions/primitive.d.ts +33 -40
- package/dist/assertions/primitive.js +232 -66
- package/dist/assertions/promise.d.ts +20 -30
- package/dist/assertions/promise.js +244 -53
- package/dist/assertions/regexp.d.ts +12 -14
- package/dist/assertions/regexp.js +84 -21
- package/dist/assertions/runtime-type.d.ts +99 -207
- package/dist/assertions/runtime-type.js +805 -276
- package/dist/assertions/throws.d.ts +24 -25
- package/dist/assertions/throws.js +43 -5
- package/dist/assertions/uuid.d.ts +11 -16
- package/dist/assertions/uuid.js +91 -22
- package/dist/assertions/values.d.ts +81 -210
- package/dist/assertions/values.js +627 -234
- package/dist/augments/assertion-exports.d.ts +0 -1
- package/dist/augments/assertion-exports.js +1 -1
- package/dist/augments/guards/assert-wrap.d.ts +7 -4
- package/dist/augments/guards/assert-wrap.js +5 -4
- package/dist/augments/guards/check-wrap.d.ts +7 -5
- package/dist/augments/guards/check-wrap.js +5 -4
- package/dist/augments/guards/check.d.ts +5 -5
- package/dist/augments/guards/check.js +5 -4
- package/dist/augments/guards/wait-until.d.ts +8 -4
- package/dist/augments/guards/wait-until.js +7 -8
- package/dist/guard-types/guard-group.d.ts +5 -2
- package/dist/guard-types/wait-until-function.d.ts +2 -10
- package/dist/guard-types/wait-until-function.js +1 -9
- package/dist/index.d.ts +1 -0
- package/package.json +2 -2
- package/dist/guard-types/assert-wrap-function.d.ts +0 -12
- package/dist/guard-types/assert-wrap-function.js +0 -14
- package/dist/guard-types/check-function.d.ts +0 -14
- package/dist/guard-types/check-function.js +0 -22
- package/dist/guard-types/check-wrap-wrapper-function.d.ts +0 -12
- package/dist/guard-types/check-wrap-wrapper-function.js +0 -19
- package/dist/guard-types/guard-override.d.ts +0 -4
- package/dist/guard-types/guard-override.js +0 -10
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import type { NarrowToActual, NarrowToExpected } from '@augment-vir/core';
|
|
2
2
|
import { type AnyObject, type MaybePromise, type Values } from '@augment-vir/core';
|
|
3
3
|
import type { EmptyObject } from 'type-fest';
|
|
4
|
-
import { autoGuardSymbol } from '../guard-types/guard-override.js';
|
|
5
4
|
import { type WaitUntilOptions } from '../guard-types/wait-until-function.js';
|
|
6
|
-
declare function
|
|
7
|
-
declare function lacksValue(parent: object, value: unknown, failureMessage?: string | undefined): void;
|
|
8
|
-
declare function hasValues(parent: object, values: ReadonlyArray<unknown>, failureMessage?: string | undefined): void;
|
|
9
|
-
declare function lacksValues(parent: object, values: ReadonlyArray<unknown>, failureMessage?: string | undefined): void;
|
|
10
|
-
export declare function isIn<const Parent extends object | string>(child: unknown, parent: Parent, failureMessage?: string | undefined): asserts child is Values<Parent>;
|
|
11
|
-
declare function isNotIn<const Parent extends object | string, const Child>(child: Child, parent: Parent, failureMessage?: string | undefined): asserts child is Exclude<Child, Values<Parent>>;
|
|
5
|
+
export declare function isIn<Parent extends object | string>(this: void, child: unknown, parent: Parent): child is Values<Parent>;
|
|
12
6
|
/**
|
|
13
7
|
* All types that can be checked for emptiness. The empty variants of these types are represented in
|
|
14
8
|
* {@link Empty}.
|
|
@@ -28,8 +22,6 @@ export type CanBeEmpty = string | Map<any, any> | Set<any> | AnyObject | any[];
|
|
|
28
22
|
* @package [`@augment-vir/assert`](https://www.npmjs.com/package/@augment-vir/assert)
|
|
29
23
|
*/
|
|
30
24
|
export type Empty = '' | EmptyObject | [] | Map<any, any> | Set<any>;
|
|
31
|
-
declare function isEmpty<const Actual extends CanBeEmpty>(actual: Actual, failureMessage?: string | undefined): asserts actual is NarrowToActual<Actual, Empty>;
|
|
32
|
-
declare function isNotEmpty<const Actual extends CanBeEmpty>(actual: Actual, failureMessage?: string | undefined): asserts actual is Exclude<Actual, Empty>;
|
|
33
25
|
export declare const valueGuards: {
|
|
34
26
|
assert: {
|
|
35
27
|
/**
|
|
@@ -54,7 +46,7 @@ export declare const valueGuards: {
|
|
|
54
46
|
* - {@link assert.lacksValue} : the opposite assertion.
|
|
55
47
|
* - {@link assert.hasValues} : the multi-value assertion.
|
|
56
48
|
*/
|
|
57
|
-
hasValue:
|
|
49
|
+
hasValue(this: void, parent: object | string, value: unknown, failureMessage?: string | undefined): void;
|
|
58
50
|
/**
|
|
59
51
|
* Asserts that an object/array parent does _not_ include a child value through reference
|
|
60
52
|
* equality.
|
|
@@ -78,7 +70,7 @@ export declare const valueGuards: {
|
|
|
78
70
|
* - {@link assert.hasValue} : the opposite assertion.
|
|
79
71
|
* - {@link assert.lacksValues} : the multi-value assertion.
|
|
80
72
|
*/
|
|
81
|
-
lacksValue:
|
|
73
|
+
lacksValue(this: void, parent: object | string, value: unknown, failureMessage?: string | undefined): void;
|
|
82
74
|
/**
|
|
83
75
|
* Asserts that an object/array parent includes all child values through reference equality.
|
|
84
76
|
*
|
|
@@ -92,21 +84,9 @@ export declare const valueGuards: {
|
|
|
92
84
|
* const child = {a: 'a'};
|
|
93
85
|
* const child2 = {b: 'b'};
|
|
94
86
|
*
|
|
95
|
-
* assert.hasValues({child, child2}, [
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* ]); // passes
|
|
99
|
-
* assert.hasValues({child: {a: 'a'}, child2}, [
|
|
100
|
-
* child,
|
|
101
|
-
* child2,
|
|
102
|
-
* ]); // fails
|
|
103
|
-
* assert.hasValues(
|
|
104
|
-
* [child],
|
|
105
|
-
* [
|
|
106
|
-
* child,
|
|
107
|
-
* child2,
|
|
108
|
-
* ],
|
|
109
|
-
* ); // passes
|
|
87
|
+
* assert.hasValues({child, child2}, [child, child2]); // passes
|
|
88
|
+
* assert.hasValues({child: {a: 'a'}, child2}, [child, child2]); // fails
|
|
89
|
+
* assert.hasValues([child], [child, child2]); // passes
|
|
110
90
|
* ```
|
|
111
91
|
*
|
|
112
92
|
* @throws {@link AssertionError} If the assertion fails.
|
|
@@ -114,7 +94,7 @@ export declare const valueGuards: {
|
|
|
114
94
|
* - {@link assert.lacksValues} : the opposite assertion.
|
|
115
95
|
* - {@link assert.hasValue} : the single-value assertion.
|
|
116
96
|
*/
|
|
117
|
-
hasValues:
|
|
97
|
+
hasValues(this: void, parent: object | string, values: unknown[], failureMessage?: string | undefined): void;
|
|
118
98
|
/**
|
|
119
99
|
* Asserts that an object/array parent includes none of the provided child values through
|
|
120
100
|
* reference equality.
|
|
@@ -129,18 +109,9 @@ export declare const valueGuards: {
|
|
|
129
109
|
* const child = {a: 'a'};
|
|
130
110
|
* const child2 = {b: 'b'};
|
|
131
111
|
*
|
|
132
|
-
* assert.lacksValues({}, [
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* ]); // passes
|
|
136
|
-
* assert.lacksValues({child, child2}, [
|
|
137
|
-
* child,
|
|
138
|
-
* child2,
|
|
139
|
-
* ]); // fails
|
|
140
|
-
* assert.lacksValues({child: {a: 'a'}, child2}, [
|
|
141
|
-
* child,
|
|
142
|
-
* child2,
|
|
143
|
-
* ]); // fails
|
|
112
|
+
* assert.lacksValues({}, [child, child2]); // passes
|
|
113
|
+
* assert.lacksValues({child, child2}, [child, child2]); // fails
|
|
114
|
+
* assert.lacksValues({child: {a: 'a'}, child2}, [child, child2]); // fails
|
|
144
115
|
* ```
|
|
145
116
|
*
|
|
146
117
|
* @throws {@link AssertionError} If the assertion fails.
|
|
@@ -148,7 +119,7 @@ export declare const valueGuards: {
|
|
|
148
119
|
* - {@link assert.lacksValues} : the opposite assertion.
|
|
149
120
|
* - {@link assert.hasValue} : the single-value assertion.
|
|
150
121
|
*/
|
|
151
|
-
lacksValues:
|
|
122
|
+
lacksValues(this: void, parent: object | string, values: unknown[], failureMessage?: string | undefined): void;
|
|
152
123
|
/**
|
|
153
124
|
* Asserts that child value is contained within a parent object, array, or string through
|
|
154
125
|
* reference equality.
|
|
@@ -174,7 +145,7 @@ export declare const valueGuards: {
|
|
|
174
145
|
* @see
|
|
175
146
|
* - {@link assert.isNotIn} : the opposite assertion.
|
|
176
147
|
*/
|
|
177
|
-
isIn:
|
|
148
|
+
isIn<Parent extends object | string>(this: void, child: unknown, parent: Parent, failureMessage?: string | undefined): asserts child is Values<Parent>;
|
|
178
149
|
/**
|
|
179
150
|
* Asserts that child value is _not_ contained within a parent object, array, or string through
|
|
180
151
|
* reference equality.
|
|
@@ -200,7 +171,7 @@ export declare const valueGuards: {
|
|
|
200
171
|
* @see
|
|
201
172
|
* - {@link assert.isIn} : the opposite assertion.
|
|
202
173
|
*/
|
|
203
|
-
isNotIn:
|
|
174
|
+
isNotIn<Parent extends object | string, Child>(this: void, child: Child, parent: Parent, failureMessage?: string | undefined): asserts child is Exclude<Child, Values<Parent>>;
|
|
204
175
|
/**
|
|
205
176
|
* Asserts that a value is empty. Supports strings, Maps, Sets, objects, and arrays.
|
|
206
177
|
*
|
|
@@ -223,7 +194,7 @@ export declare const valueGuards: {
|
|
|
223
194
|
* @see
|
|
224
195
|
* - {@link assert.isNotEmpty} : the opposite assertion.
|
|
225
196
|
*/
|
|
226
|
-
isEmpty:
|
|
197
|
+
isEmpty<Actual extends CanBeEmpty>(this: void, actual: Actual, failureMessage?: string | undefined): asserts actual is NarrowToActual<Actual, Empty>;
|
|
227
198
|
/**
|
|
228
199
|
* Asserts that a value is _not_ empty. Supports strings, Maps, Sets, objects, and arrays.
|
|
229
200
|
*
|
|
@@ -246,7 +217,7 @@ export declare const valueGuards: {
|
|
|
246
217
|
* @see
|
|
247
218
|
* - {@link assert.isEmpty} : the opposite assertion.
|
|
248
219
|
*/
|
|
249
|
-
isNotEmpty:
|
|
220
|
+
isNotEmpty<Actual extends CanBeEmpty>(this: void, actual: Actual, failureMessage?: string | undefined): asserts actual is Exclude<Actual, Empty>;
|
|
250
221
|
};
|
|
251
222
|
check: {
|
|
252
223
|
/**
|
|
@@ -270,7 +241,7 @@ export declare const valueGuards: {
|
|
|
270
241
|
* - {@link check.lacksValue} : the opposite check.
|
|
271
242
|
* - {@link check.hasValues} : the multi-value check.
|
|
272
243
|
*/
|
|
273
|
-
hasValue:
|
|
244
|
+
hasValue(this: void, parent: object | string, value: unknown): boolean;
|
|
274
245
|
/**
|
|
275
246
|
* Checks that an object/array parent does _not_ include a child value through reference
|
|
276
247
|
* equality.
|
|
@@ -293,7 +264,7 @@ export declare const valueGuards: {
|
|
|
293
264
|
* - {@link check.hasValue} : the opposite check.
|
|
294
265
|
* - {@link check.lacksValues} : the multi-value check.
|
|
295
266
|
*/
|
|
296
|
-
lacksValue:
|
|
267
|
+
lacksValue(this: void, parent: object | string, value: unknown): boolean;
|
|
297
268
|
/**
|
|
298
269
|
* Checks that an object/array parent includes all child values through reference equality.
|
|
299
270
|
*
|
|
@@ -307,28 +278,16 @@ export declare const valueGuards: {
|
|
|
307
278
|
* const child = {a: 'a'};
|
|
308
279
|
* const child2 = {b: 'b'};
|
|
309
280
|
*
|
|
310
|
-
* check.hasValues({child, child2}, [
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* ]); // returns `true`
|
|
314
|
-
* check.hasValues({child: {a: 'a'}, child2}, [
|
|
315
|
-
* child,
|
|
316
|
-
* child2,
|
|
317
|
-
* ]); // returns `false`
|
|
318
|
-
* check.hasValues(
|
|
319
|
-
* [child],
|
|
320
|
-
* [
|
|
321
|
-
* child,
|
|
322
|
-
* child2,
|
|
323
|
-
* ],
|
|
324
|
-
* ); // returns `true`
|
|
281
|
+
* check.hasValues({child, child2}, [child, child2]); // returns `true`
|
|
282
|
+
* check.hasValues({child: {a: 'a'}, child2}, [child, child2]); // returns `false`
|
|
283
|
+
* check.hasValues([child], [child, child2]); // returns `true`
|
|
325
284
|
* ```
|
|
326
285
|
*
|
|
327
286
|
* @see
|
|
328
287
|
* - {@link check.lacksValues} : the opposite check.
|
|
329
288
|
* - {@link check.hasValue} : the single-value check.
|
|
330
289
|
*/
|
|
331
|
-
hasValues:
|
|
290
|
+
hasValues(this: void, parent: object | string, values: unknown[]): boolean;
|
|
332
291
|
/**
|
|
333
292
|
* Checks that an object/array parent includes none of the provided child values through
|
|
334
293
|
* reference equality.
|
|
@@ -343,25 +302,16 @@ export declare const valueGuards: {
|
|
|
343
302
|
* const child = {a: 'a'};
|
|
344
303
|
* const child2 = {b: 'b'};
|
|
345
304
|
*
|
|
346
|
-
* check.lacksValues({}, [
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
* ]); // returns `true`
|
|
350
|
-
* check.lacksValues({child, child2}, [
|
|
351
|
-
* child,
|
|
352
|
-
* child2,
|
|
353
|
-
* ]); // returns `false`
|
|
354
|
-
* check.lacksValues({child: {a: 'a'}, child2}, [
|
|
355
|
-
* child,
|
|
356
|
-
* child2,
|
|
357
|
-
* ]); // returns `false`
|
|
305
|
+
* check.lacksValues({}, [child, child2]); // returns `true`
|
|
306
|
+
* check.lacksValues({child, child2}, [child, child2]); // returns `false`
|
|
307
|
+
* check.lacksValues({child: {a: 'a'}, child2}, [child, child2]); // returns `false`
|
|
358
308
|
* ```
|
|
359
309
|
*
|
|
360
310
|
* @see
|
|
361
311
|
* - {@link check.lacksValues} : the opposite check.
|
|
362
312
|
* - {@link check.hasValue} : the single-value check.
|
|
363
313
|
*/
|
|
364
|
-
lacksValues:
|
|
314
|
+
lacksValues(this: void, parent: object | string, values: unknown[]): boolean;
|
|
365
315
|
/**
|
|
366
316
|
* Checks that child value is contained within a parent object, array, or string through
|
|
367
317
|
* reference equality.
|
|
@@ -386,7 +336,7 @@ export declare const valueGuards: {
|
|
|
386
336
|
* @see
|
|
387
337
|
* - {@link check.isNotIn} : the opposite check.
|
|
388
338
|
*/
|
|
389
|
-
isIn
|
|
339
|
+
isIn<Parent extends object | string>(this: void, child: unknown, parent: Parent): child is Values<Parent>;
|
|
390
340
|
/**
|
|
391
341
|
* Checks that child value is _not_ contained within a parent object, array, or string
|
|
392
342
|
* through reference equality.
|
|
@@ -411,7 +361,7 @@ export declare const valueGuards: {
|
|
|
411
361
|
* @see
|
|
412
362
|
* - {@link check.isIn} : the opposite check.
|
|
413
363
|
*/
|
|
414
|
-
isNotIn
|
|
364
|
+
isNotIn<Parent extends object | string, Child>(this: void, child: Child, parent: Parent): child is Exclude<Child, Values<Parent>>;
|
|
415
365
|
/**
|
|
416
366
|
* Checks that a value is empty. Supports strings, Maps, Sets, objects, and arrays.
|
|
417
367
|
*
|
|
@@ -433,7 +383,7 @@ export declare const valueGuards: {
|
|
|
433
383
|
* @see
|
|
434
384
|
* - {@link check.isNotEmpty} : the opposite check.
|
|
435
385
|
*/
|
|
436
|
-
isEmpty
|
|
386
|
+
isEmpty<Actual extends CanBeEmpty>(this: void, actual: Actual): actual is NarrowToActual<Actual, Empty>;
|
|
437
387
|
/**
|
|
438
388
|
* Checks that a value is _not_ empty. Supports strings, Maps, Sets, objects, and arrays.
|
|
439
389
|
*
|
|
@@ -455,7 +405,7 @@ export declare const valueGuards: {
|
|
|
455
405
|
* @see
|
|
456
406
|
* - {@link check.isEmpty} : the opposite check.
|
|
457
407
|
*/
|
|
458
|
-
isNotEmpty
|
|
408
|
+
isNotEmpty<Actual extends CanBeEmpty>(this: void, actual: Actual): actual is Exclude<Actual, Empty>;
|
|
459
409
|
};
|
|
460
410
|
assertWrap: {
|
|
461
411
|
/**
|
|
@@ -482,7 +432,7 @@ export declare const valueGuards: {
|
|
|
482
432
|
* - {@link assertWrap.lacksValue} : the opposite assertion.
|
|
483
433
|
* - {@link assertWrap.hasValues} : the multi-value assertion.
|
|
484
434
|
*/
|
|
485
|
-
hasValue:
|
|
435
|
+
hasValue<Parent extends object | string>(this: void, parent: Parent, value: unknown, failureMessage?: string | undefined): Parent;
|
|
486
436
|
/**
|
|
487
437
|
* Asserts that an object/array parent does _not_ include a child value through reference
|
|
488
438
|
* equality. Returns the parent value if the assertion passes.
|
|
@@ -507,7 +457,7 @@ export declare const valueGuards: {
|
|
|
507
457
|
* - {@link assertWrap.hasValue} : the opposite assertion.
|
|
508
458
|
* - {@link assertWrap.lacksValues} : the multi-value assertion.
|
|
509
459
|
*/
|
|
510
|
-
lacksValue:
|
|
460
|
+
lacksValue<Parent extends object | string>(this: void, parent: Parent, value: unknown, failureMessage?: string | undefined): Parent;
|
|
511
461
|
/**
|
|
512
462
|
* Asserts that an object/array parent includes all child values through reference equality.
|
|
513
463
|
* Returns the parent value if the assertion passes.
|
|
@@ -522,21 +472,9 @@ export declare const valueGuards: {
|
|
|
522
472
|
* const child = {a: 'a'};
|
|
523
473
|
* const child2 = {b: 'b'};
|
|
524
474
|
*
|
|
525
|
-
* assertWrap.hasValues({child, child2}, [
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
* ]); // returns `{child, child2}`;
|
|
529
|
-
* assertWrap.hasValues({child: {a: 'a'}, child2}, [
|
|
530
|
-
* child,
|
|
531
|
-
* child2,
|
|
532
|
-
* ]); // throws an error
|
|
533
|
-
* assertWrap.hasValues(
|
|
534
|
-
* [child],
|
|
535
|
-
* [
|
|
536
|
-
* child,
|
|
537
|
-
* child2,
|
|
538
|
-
* ],
|
|
539
|
-
* ); // returns `[child]`;
|
|
475
|
+
* assertWrap.hasValues({child, child2}, [child, child2]); // returns `{child, child2}`;
|
|
476
|
+
* assertWrap.hasValues({child: {a: 'a'}, child2}, [child, child2]); // throws an error
|
|
477
|
+
* assertWrap.hasValues([child], [child, child2]); // returns `[child]`;
|
|
540
478
|
* ```
|
|
541
479
|
*
|
|
542
480
|
* @returns The value if the assertion passes.
|
|
@@ -545,7 +483,7 @@ export declare const valueGuards: {
|
|
|
545
483
|
* - {@link assertWrap.lacksValues} : the opposite assertion.
|
|
546
484
|
* - {@link assertWrap.hasValue} : the single-value assertion.
|
|
547
485
|
*/
|
|
548
|
-
hasValues:
|
|
486
|
+
hasValues<Parent extends object | string>(this: void, parent: Parent, values: unknown[], failureMessage?: string | undefined): Parent;
|
|
549
487
|
/**
|
|
550
488
|
* Asserts that an object/array parent includes none of the provided child values through
|
|
551
489
|
* reference equality. Returns the parent value if the assertion passes.
|
|
@@ -560,18 +498,9 @@ export declare const valueGuards: {
|
|
|
560
498
|
* const child = {a: 'a'};
|
|
561
499
|
* const child2 = {b: 'b'};
|
|
562
500
|
*
|
|
563
|
-
* assertWrap.lacksValues({}, [
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
* ]); // returns `{}`;
|
|
567
|
-
* assertWrap.lacksValues({child, child2}, [
|
|
568
|
-
* child,
|
|
569
|
-
* child2,
|
|
570
|
-
* ]); // throws an error
|
|
571
|
-
* assertWrap.lacksValues({child: {a: 'a'}, child2}, [
|
|
572
|
-
* child,
|
|
573
|
-
* child2,
|
|
574
|
-
* ]); // throws an error
|
|
501
|
+
* assertWrap.lacksValues({}, [child, child2]); // returns `{}`;
|
|
502
|
+
* assertWrap.lacksValues({child, child2}, [child, child2]); // throws an error
|
|
503
|
+
* assertWrap.lacksValues({child: {a: 'a'}, child2}, [child, child2]); // throws an error
|
|
575
504
|
* ```
|
|
576
505
|
*
|
|
577
506
|
* @returns The value if the assertion passes.
|
|
@@ -580,7 +509,7 @@ export declare const valueGuards: {
|
|
|
580
509
|
* - {@link assertWrap.lacksValues} : the opposite assertion.
|
|
581
510
|
* - {@link assertWrap.hasValue} : the single-value assertion.
|
|
582
511
|
*/
|
|
583
|
-
lacksValues:
|
|
512
|
+
lacksValues<Parent extends object | string>(this: void, parent: Parent, values: unknown[], failureMessage?: string | undefined): Parent;
|
|
584
513
|
/**
|
|
585
514
|
* Asserts that child value is contained within a parent object, array, or string through
|
|
586
515
|
* reference equality. Returns the child value if the assertion passes.
|
|
@@ -607,7 +536,7 @@ export declare const valueGuards: {
|
|
|
607
536
|
* @see
|
|
608
537
|
* - {@link assertWrap.isNotIn} : the opposite assertion.
|
|
609
538
|
*/
|
|
610
|
-
isIn
|
|
539
|
+
isIn<Parent extends object | string, Child>(this: void, child: Child, parent: Parent, failureMessage?: string | undefined): Extract<Child, Values<Parent>>;
|
|
611
540
|
/**
|
|
612
541
|
* Asserts that child value is _not_ contained within a parent object, array, or string
|
|
613
542
|
* through reference equality. Returns the child value if the assertion passes.
|
|
@@ -634,7 +563,7 @@ export declare const valueGuards: {
|
|
|
634
563
|
* @see
|
|
635
564
|
* - {@link assertWrap.isIn} : the opposite assertion.
|
|
636
565
|
*/
|
|
637
|
-
isNotIn
|
|
566
|
+
isNotIn<Parent extends object | string, Child>(this: void, child: Child, parent: Parent, failureMessage?: string | undefined): Exclude<Child, Values<Parent>>;
|
|
638
567
|
/**
|
|
639
568
|
* Asserts that a value is empty. Supports strings, Maps, Sets, objects, and arrays. Returns
|
|
640
569
|
* the value if the assertion passes.
|
|
@@ -659,7 +588,7 @@ export declare const valueGuards: {
|
|
|
659
588
|
* @see
|
|
660
589
|
* - {@link assertWrap.isNotEmpty} : the opposite assertion.
|
|
661
590
|
*/
|
|
662
|
-
isEmpty
|
|
591
|
+
isEmpty<Actual extends CanBeEmpty>(this: void, actual: Actual, failureMessage?: string | undefined): NarrowToActual<Actual, Empty>;
|
|
663
592
|
/**
|
|
664
593
|
* Asserts that a value is _not_ empty. Supports strings, Maps, Sets, objects, and arrays.
|
|
665
594
|
* Returns the value if the assertion passes.
|
|
@@ -684,7 +613,7 @@ export declare const valueGuards: {
|
|
|
684
613
|
* @see
|
|
685
614
|
* - {@link assertWrap.isEmpty} : the opposite assertion.
|
|
686
615
|
*/
|
|
687
|
-
isNotEmpty
|
|
616
|
+
isNotEmpty<Actual extends CanBeEmpty>(this: void, actual: Actual, failureMessage?: string | undefined): Exclude<Actual, Empty>;
|
|
688
617
|
};
|
|
689
618
|
checkWrap: {
|
|
690
619
|
/**
|
|
@@ -708,7 +637,7 @@ export declare const valueGuards: {
|
|
|
708
637
|
* - {@link checkWrap.lacksValue} : the opposite check.
|
|
709
638
|
* - {@link checkWrap.hasValues} : the multi-value check.
|
|
710
639
|
*/
|
|
711
|
-
hasValue:
|
|
640
|
+
hasValue<Parent extends object | string>(this: void, parent: Parent, value: unknown): Parent | undefined;
|
|
712
641
|
/**
|
|
713
642
|
* Checks that an object/array parent does _not_ include a child value through reference
|
|
714
643
|
* equality.
|
|
@@ -731,7 +660,7 @@ export declare const valueGuards: {
|
|
|
731
660
|
* - {@link checkWrap.hasValue} : the opposite check.
|
|
732
661
|
* - {@link checkWrap.lacksValues} : the multi-value check.
|
|
733
662
|
*/
|
|
734
|
-
lacksValue:
|
|
663
|
+
lacksValue<Parent extends object | string>(this: void, parent: Parent, value: unknown): Parent | undefined;
|
|
735
664
|
/**
|
|
736
665
|
* Checks that an object/array parent includes all child values through reference equality.
|
|
737
666
|
*
|
|
@@ -745,28 +674,16 @@ export declare const valueGuards: {
|
|
|
745
674
|
* const child = {a: 'a'};
|
|
746
675
|
* const child2 = {b: 'b'};
|
|
747
676
|
*
|
|
748
|
-
* checkWrap.hasValues({child, child2}, [
|
|
749
|
-
*
|
|
750
|
-
*
|
|
751
|
-
* ]); // returns `{child, child2}`
|
|
752
|
-
* checkWrap.hasValues({child: {a: 'a'}, child2}, [
|
|
753
|
-
* child,
|
|
754
|
-
* child2,
|
|
755
|
-
* ]); // returns `undefined`
|
|
756
|
-
* checkWrap.hasValues(
|
|
757
|
-
* [child],
|
|
758
|
-
* [
|
|
759
|
-
* child,
|
|
760
|
-
* child2,
|
|
761
|
-
* ],
|
|
762
|
-
* ); // returns `[child]`
|
|
677
|
+
* checkWrap.hasValues({child, child2}, [child, child2]); // returns `{child, child2}`
|
|
678
|
+
* checkWrap.hasValues({child: {a: 'a'}, child2}, [child, child2]); // returns `undefined`
|
|
679
|
+
* checkWrap.hasValues([child], [child, child2]); // returns `[child]`
|
|
763
680
|
* ```
|
|
764
681
|
*
|
|
765
682
|
* @see
|
|
766
683
|
* - {@link checkWrap.lacksValues} : the opposite check.
|
|
767
684
|
* - {@link checkWrap.hasValue} : the single-value check.
|
|
768
685
|
*/
|
|
769
|
-
hasValues:
|
|
686
|
+
hasValues<Parent extends object | string>(this: void, parent: Parent, values: unknown[]): Parent | undefined;
|
|
770
687
|
/**
|
|
771
688
|
* Checks that an object/array parent includes none of the provided child values through
|
|
772
689
|
* reference equality.
|
|
@@ -781,25 +698,16 @@ export declare const valueGuards: {
|
|
|
781
698
|
* const child = {a: 'a'};
|
|
782
699
|
* const child2 = {b: 'b'};
|
|
783
700
|
*
|
|
784
|
-
* checkWrap.lacksValues({}, [
|
|
785
|
-
*
|
|
786
|
-
*
|
|
787
|
-
* ]); // returns `{}`
|
|
788
|
-
* checkWrap.lacksValues({child, child2}, [
|
|
789
|
-
* child,
|
|
790
|
-
* child2,
|
|
791
|
-
* ]); // returns `undefined`
|
|
792
|
-
* checkWrap.lacksValues({child: {a: 'a'}, child2}, [
|
|
793
|
-
* child,
|
|
794
|
-
* child2,
|
|
795
|
-
* ]); // returns `undefined`
|
|
701
|
+
* checkWrap.lacksValues({}, [child, child2]); // returns `{}`
|
|
702
|
+
* checkWrap.lacksValues({child, child2}, [child, child2]); // returns `undefined`
|
|
703
|
+
* checkWrap.lacksValues({child: {a: 'a'}, child2}, [child, child2]); // returns `undefined`
|
|
796
704
|
* ```
|
|
797
705
|
*
|
|
798
706
|
* @see
|
|
799
707
|
* - {@link checkWrap.lacksValues} : the opposite check.
|
|
800
708
|
* - {@link checkWrap.hasValue} : the single-value check.
|
|
801
709
|
*/
|
|
802
|
-
lacksValues:
|
|
710
|
+
lacksValues<Parent extends object | string>(this: void, parent: Parent, values: unknown[]): Parent | undefined;
|
|
803
711
|
/**
|
|
804
712
|
* Checks that child value is contained within a parent object, array, or string through
|
|
805
713
|
* reference equality.
|
|
@@ -824,7 +732,7 @@ export declare const valueGuards: {
|
|
|
824
732
|
* @see
|
|
825
733
|
* - {@link checkWrap.isNotIn} : the opposite check.
|
|
826
734
|
*/
|
|
827
|
-
isIn
|
|
735
|
+
isIn<Parent extends object | string, Child>(this: void, child: Child, parent: Parent): Extract<Child, Values<Parent>> | undefined;
|
|
828
736
|
/**
|
|
829
737
|
* Checks that child value is _not_ contained within a parent object, array, or string
|
|
830
738
|
* through reference equality.
|
|
@@ -849,7 +757,7 @@ export declare const valueGuards: {
|
|
|
849
757
|
* @see
|
|
850
758
|
* - {@link checkWrap.isIn} : the opposite check.
|
|
851
759
|
*/
|
|
852
|
-
isNotIn
|
|
760
|
+
isNotIn<Parent extends object | string, Child>(this: void, child: Child, parent: Parent): Exclude<Child, Values<Parent>> | undefined;
|
|
853
761
|
/**
|
|
854
762
|
* Checks that a value is empty. Supports strings, Maps, Sets, objects, and arrays.
|
|
855
763
|
*
|
|
@@ -871,7 +779,7 @@ export declare const valueGuards: {
|
|
|
871
779
|
* @see
|
|
872
780
|
* - {@link checkWrap.isNotEmpty} : the opposite check.
|
|
873
781
|
*/
|
|
874
|
-
isEmpty
|
|
782
|
+
isEmpty<Actual extends CanBeEmpty>(this: void, actual: Actual): NarrowToActual<Actual, Empty> | undefined;
|
|
875
783
|
/**
|
|
876
784
|
* Checks that a value is _not_ empty. Supports strings, Maps, Sets, objects, and arrays.
|
|
877
785
|
*
|
|
@@ -893,7 +801,7 @@ export declare const valueGuards: {
|
|
|
893
801
|
* @see
|
|
894
802
|
* - {@link checkWrap.isEmpty} : the opposite check.
|
|
895
803
|
*/
|
|
896
|
-
isNotEmpty
|
|
804
|
+
isNotEmpty<Actual extends CanBeEmpty>(this: void, actual: Actual): Exclude<Actual, Empty> | undefined;
|
|
897
805
|
};
|
|
898
806
|
waitUntil: {
|
|
899
807
|
/**
|
|
@@ -925,7 +833,7 @@ export declare const valueGuards: {
|
|
|
925
833
|
* - {@link waitUntil.lacksValue} : the opposite assertion.
|
|
926
834
|
* - {@link waitUntil.hasValues} : the multi-value assertion.
|
|
927
835
|
*/
|
|
928
|
-
hasValue:
|
|
836
|
+
hasValue: <Parent extends object | string>(this: void, value: unknown, callback: () => MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Parent>;
|
|
929
837
|
/**
|
|
930
838
|
* Repeatedly calls a callback until its output is an object/array parent does _not_ include
|
|
931
839
|
* a child value through reference equality. Once the callback output passes, it is
|
|
@@ -955,7 +863,7 @@ export declare const valueGuards: {
|
|
|
955
863
|
* - {@link waitUntil.hasValue} : the opposite assertion.
|
|
956
864
|
* - {@link waitUntil.lacksValues} : the multi-value assertion.
|
|
957
865
|
*/
|
|
958
|
-
lacksValue:
|
|
866
|
+
lacksValue: <Parent extends object | string>(this: void, value: unknown, callback: () => MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Parent>;
|
|
959
867
|
/**
|
|
960
868
|
* Repeatedly calls a callback until its output is an object/array parent includes all child
|
|
961
869
|
* values through reference equality. Once the callback output passes, it is returned. If
|
|
@@ -971,31 +879,13 @@ export declare const valueGuards: {
|
|
|
971
879
|
* const child = {a: 'a'};
|
|
972
880
|
* const child2 = {b: 'b'};
|
|
973
881
|
*
|
|
974
|
-
* await waitUntil.hasValues(
|
|
975
|
-
*
|
|
976
|
-
*
|
|
977
|
-
*
|
|
978
|
-
*
|
|
979
|
-
*
|
|
980
|
-
*
|
|
981
|
-
* },
|
|
982
|
-
* ); // returns `{child, child2}`;
|
|
983
|
-
* await waitUntil.hasValues(
|
|
984
|
-
* [
|
|
985
|
-
* child,
|
|
986
|
-
* child2,
|
|
987
|
-
* ],
|
|
988
|
-
* () => {
|
|
989
|
-
* return {child: {a: 'a'}, child2};
|
|
990
|
-
* },
|
|
991
|
-
* ); // throws an error
|
|
992
|
-
* await waitUntil.hasValues(
|
|
993
|
-
* [
|
|
994
|
-
* child,
|
|
995
|
-
* child2,
|
|
996
|
-
* ],
|
|
997
|
-
* () => [child],
|
|
998
|
-
* ); // returns `[child]`;
|
|
882
|
+
* await waitUntil.hasValues([child, child2], () => {
|
|
883
|
+
* return {child, child2};
|
|
884
|
+
* }); // returns `{child, child2}`;
|
|
885
|
+
* await waitUntil.hasValues([child, child2], () => {
|
|
886
|
+
* return {child: {a: 'a'}, child2};
|
|
887
|
+
* }); // throws an error
|
|
888
|
+
* await waitUntil.hasValues([child, child2], () => [child]); // returns `[child]`;
|
|
999
889
|
* ```
|
|
1000
890
|
*
|
|
1001
891
|
* @returns The callback output once it passes.
|
|
@@ -1004,7 +894,7 @@ export declare const valueGuards: {
|
|
|
1004
894
|
* - {@link waitUntil.lacksValues} : the opposite assertion.
|
|
1005
895
|
* - {@link waitUntil.hasValue} : the single-value assertion.
|
|
1006
896
|
*/
|
|
1007
|
-
hasValues:
|
|
897
|
+
hasValues: <Parent extends object | string>(this: void, value: unknown[], callback: () => MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Parent>;
|
|
1008
898
|
/**
|
|
1009
899
|
* Repeatedly calls a callback until its output is an object/array parent includes none of
|
|
1010
900
|
* the provided child values through reference equality. Once the callback output passes, it
|
|
@@ -1020,33 +910,15 @@ export declare const valueGuards: {
|
|
|
1020
910
|
* const child = {a: 'a'};
|
|
1021
911
|
* const child2 = {b: 'b'};
|
|
1022
912
|
*
|
|
1023
|
-
* await waitUntil.lacksValues(
|
|
1024
|
-
*
|
|
1025
|
-
*
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
1028
|
-
*
|
|
1029
|
-
*
|
|
1030
|
-
* },
|
|
1031
|
-
* ); //
|
|
1032
|
-
* await waitUntil.lacksValues(
|
|
1033
|
-
* [
|
|
1034
|
-
* child,
|
|
1035
|
-
* child2,
|
|
1036
|
-
* ],
|
|
1037
|
-
* () => {
|
|
1038
|
-
* return {child, child2};
|
|
1039
|
-
* },
|
|
1040
|
-
* ); // throws an error
|
|
1041
|
-
* await waitUntil.lacksValues(
|
|
1042
|
-
* [
|
|
1043
|
-
* child,
|
|
1044
|
-
* child2,
|
|
1045
|
-
* ],
|
|
1046
|
-
* () => {
|
|
1047
|
-
* return {child: {a: 'a'}, child2};
|
|
1048
|
-
* },
|
|
1049
|
-
* ); // throws an error
|
|
913
|
+
* await waitUntil.lacksValues([child, child2], () => {
|
|
914
|
+
* return {};
|
|
915
|
+
* }); // returns `{}`;
|
|
916
|
+
* await waitUntil.lacksValues([child, child2], () => {
|
|
917
|
+
* return {child, child2};
|
|
918
|
+
* }); // throws an error
|
|
919
|
+
* await waitUntil.lacksValues([child, child2], () => {
|
|
920
|
+
* return {child: {a: 'a'}, child2};
|
|
921
|
+
* }); // throws an error
|
|
1050
922
|
* ```
|
|
1051
923
|
*
|
|
1052
924
|
* @returns The callback output once it passes.
|
|
@@ -1055,7 +927,7 @@ export declare const valueGuards: {
|
|
|
1055
927
|
* - {@link waitUntil.lacksValues} : the opposite assertion.
|
|
1056
928
|
* - {@link waitUntil.hasValue} : the single-value assertion.
|
|
1057
929
|
*/
|
|
1058
|
-
lacksValues:
|
|
930
|
+
lacksValues: <Parent extends object | string>(this: void, value: unknown[], callback: () => MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Parent>;
|
|
1059
931
|
/**
|
|
1060
932
|
* Repeatedly calls a callback until its output is child value is contained within a parent
|
|
1061
933
|
* object, array, or string through reference equality. Once the callback output passes, it
|
|
@@ -1083,7 +955,7 @@ export declare const valueGuards: {
|
|
|
1083
955
|
* @see
|
|
1084
956
|
* - {@link waitUntil.isNotIn} : the opposite assertion.
|
|
1085
957
|
*/
|
|
1086
|
-
isIn: <
|
|
958
|
+
isIn: <Child, Parent>(this: void, parent: Parent, callback: () => MaybePromise<Child>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<NarrowToExpected<Child, Values<Parent>>>;
|
|
1087
959
|
/**
|
|
1088
960
|
* Repeatedly calls a callback until its output is child value is _not_ contained within a
|
|
1089
961
|
* parent object, array, or string through reference equality. Once the callback output
|
|
@@ -1111,7 +983,7 @@ export declare const valueGuards: {
|
|
|
1111
983
|
* @see
|
|
1112
984
|
* - {@link waitUntil.isIn} : the opposite assertion.
|
|
1113
985
|
*/
|
|
1114
|
-
isNotIn: <
|
|
986
|
+
isNotIn: <Child, Parent>(this: void, parent: Parent, callback: () => MaybePromise<Child>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Child, Values<Parent>>>;
|
|
1115
987
|
/**
|
|
1116
988
|
* Repeatedly calls a callback until its output is a value is empty. Supports strings, Maps,
|
|
1117
989
|
* Sets, objects, and arrays. Once the callback output passes, it is returned. If the
|
|
@@ -1141,7 +1013,7 @@ export declare const valueGuards: {
|
|
|
1141
1013
|
* @see
|
|
1142
1014
|
* - {@link waitUntil.isNotEmpty} : the opposite assertion.
|
|
1143
1015
|
*/
|
|
1144
|
-
isEmpty: <
|
|
1016
|
+
isEmpty: <Actual extends CanBeEmpty>(this: void, callback: () => MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<NarrowToActual<Actual, Empty>>;
|
|
1145
1017
|
/**
|
|
1146
1018
|
* Repeatedly calls a callback until its output is a value is _not_ empty. Supports strings,
|
|
1147
1019
|
* Maps, Sets, objects, and arrays. Once the callback output passes, it is returned. If the
|
|
@@ -1171,7 +1043,6 @@ export declare const valueGuards: {
|
|
|
1171
1043
|
* @see
|
|
1172
1044
|
* - {@link waitUntil.isEmpty} : the opposite assertion.
|
|
1173
1045
|
*/
|
|
1174
|
-
isNotEmpty: <
|
|
1046
|
+
isNotEmpty: <Actual extends CanBeEmpty>(this: void, callback: () => MaybePromise<Actual>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Actual, Empty>>;
|
|
1175
1047
|
};
|
|
1176
1048
|
};
|
|
1177
|
-
export {};
|