@augment-vir/assert 31.0.0 → 31.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 -162
- 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 -150
- package/dist/assertions/runtime-type.js +805 -229
- 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/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
|
@@ -32,29 +32,9 @@ export declare const lengthGuards: {
|
|
|
32
32
|
* ```ts
|
|
33
33
|
* import {assert} from '@augment-vir/assert';
|
|
34
34
|
*
|
|
35
|
-
* assert.isLengthAtLeast(
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* 'b',
|
|
39
|
-
* 'c',
|
|
40
|
-
* ],
|
|
41
|
-
* 2,
|
|
42
|
-
* ); // passes
|
|
43
|
-
* assert.isLengthAtLeast(
|
|
44
|
-
* [
|
|
45
|
-
* 'a',
|
|
46
|
-
* 'b',
|
|
47
|
-
* 'c',
|
|
48
|
-
* ],
|
|
49
|
-
* 3,
|
|
50
|
-
* ); // passes
|
|
51
|
-
* assert.isLengthAtLeast(
|
|
52
|
-
* [
|
|
53
|
-
* 'a',
|
|
54
|
-
* 'b',
|
|
55
|
-
* ],
|
|
56
|
-
* 3,
|
|
57
|
-
* ); // fails
|
|
35
|
+
* assert.isLengthAtLeast(['a', 'b', 'c'], 2); // passes
|
|
36
|
+
* assert.isLengthAtLeast(['a', 'b', 'c'], 3); // passes
|
|
37
|
+
* assert.isLengthAtLeast(['a', 'b'], 3); // fails
|
|
58
38
|
* ```
|
|
59
39
|
*
|
|
60
40
|
* @throws {@link AssertionError} If the value is less than the given length.
|
|
@@ -72,29 +52,9 @@ export declare const lengthGuards: {
|
|
|
72
52
|
* ```ts
|
|
73
53
|
* import {assert} from '@augment-vir/assert';
|
|
74
54
|
*
|
|
75
|
-
* assert.isLengthExactly(
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* 'b',
|
|
79
|
-
* 'c',
|
|
80
|
-
* ],
|
|
81
|
-
* 2,
|
|
82
|
-
* ); // fails
|
|
83
|
-
* assert.isLengthExactly(
|
|
84
|
-
* [
|
|
85
|
-
* 'a',
|
|
86
|
-
* 'b',
|
|
87
|
-
* 'c',
|
|
88
|
-
* ],
|
|
89
|
-
* 3,
|
|
90
|
-
* ); // passes
|
|
91
|
-
* assert.isLengthExactly(
|
|
92
|
-
* [
|
|
93
|
-
* 'a',
|
|
94
|
-
* 'b',
|
|
95
|
-
* ],
|
|
96
|
-
* 3,
|
|
97
|
-
* ); // fails
|
|
55
|
+
* assert.isLengthExactly(['a', 'b', 'c'], 2); // fails
|
|
56
|
+
* assert.isLengthExactly(['a', 'b', 'c'], 3); // passes
|
|
57
|
+
* assert.isLengthExactly(['a', 'b'], 3); // fails
|
|
98
58
|
* ```
|
|
99
59
|
*
|
|
100
60
|
* @throws {@link AssertionError} If the value is not exactly the given length.
|
|
@@ -114,29 +74,9 @@ export declare const lengthGuards: {
|
|
|
114
74
|
* ```ts
|
|
115
75
|
* import {check} from '@augment-vir/assert';
|
|
116
76
|
*
|
|
117
|
-
* check.isLengthAtLeast(
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* 'b',
|
|
121
|
-
* 'c',
|
|
122
|
-
* ],
|
|
123
|
-
* 2,
|
|
124
|
-
* ); // returns `true`
|
|
125
|
-
* check.isLengthAtLeast(
|
|
126
|
-
* [
|
|
127
|
-
* 'a',
|
|
128
|
-
* 'b',
|
|
129
|
-
* 'c',
|
|
130
|
-
* ],
|
|
131
|
-
* 3,
|
|
132
|
-
* ); // returns `true`
|
|
133
|
-
* check.isLengthAtLeast(
|
|
134
|
-
* [
|
|
135
|
-
* 'a',
|
|
136
|
-
* 'b',
|
|
137
|
-
* ],
|
|
138
|
-
* 3,
|
|
139
|
-
* ); // returns `false`
|
|
77
|
+
* check.isLengthAtLeast(['a', 'b', 'c'], 2); // returns `true`
|
|
78
|
+
* check.isLengthAtLeast(['a', 'b', 'c'], 3); // returns `true`
|
|
79
|
+
* check.isLengthAtLeast(['a', 'b'], 3); // returns `false`
|
|
140
80
|
* ```
|
|
141
81
|
*
|
|
142
82
|
* @see
|
|
@@ -153,29 +93,9 @@ export declare const lengthGuards: {
|
|
|
153
93
|
* ```ts
|
|
154
94
|
* import {check} from '@augment-vir/assert';
|
|
155
95
|
*
|
|
156
|
-
* check.isLengthExactly(
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
* 'b',
|
|
160
|
-
* 'c',
|
|
161
|
-
* ],
|
|
162
|
-
* 2,
|
|
163
|
-
* ); // fails
|
|
164
|
-
* check.isLengthExactly(
|
|
165
|
-
* [
|
|
166
|
-
* 'a',
|
|
167
|
-
* 'b',
|
|
168
|
-
* 'c',
|
|
169
|
-
* ],
|
|
170
|
-
* 3,
|
|
171
|
-
* ); // passes
|
|
172
|
-
* check.isLengthExactly(
|
|
173
|
-
* [
|
|
174
|
-
* 'a',
|
|
175
|
-
* 'b',
|
|
176
|
-
* ],
|
|
177
|
-
* 3,
|
|
178
|
-
* ); // fails
|
|
96
|
+
* check.isLengthExactly(['a', 'b', 'c'], 2); // fails
|
|
97
|
+
* check.isLengthExactly(['a', 'b', 'c'], 3); // passes
|
|
98
|
+
* check.isLengthExactly(['a', 'b'], 3); // fails
|
|
179
99
|
* ```
|
|
180
100
|
*
|
|
181
101
|
* @see
|
|
@@ -195,29 +115,9 @@ export declare const lengthGuards: {
|
|
|
195
115
|
* ```ts
|
|
196
116
|
* import {assertWrap} from '@augment-vir/assert';
|
|
197
117
|
*
|
|
198
|
-
* assertWrap.isLengthAtLeast(
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
* 'b',
|
|
202
|
-
* 'c',
|
|
203
|
-
* ],
|
|
204
|
-
* 2,
|
|
205
|
-
* ); // returns `['a', 'b', 'c']`
|
|
206
|
-
* assertWrap.isLengthAtLeast(
|
|
207
|
-
* [
|
|
208
|
-
* 'a',
|
|
209
|
-
* 'b',
|
|
210
|
-
* 'c',
|
|
211
|
-
* ],
|
|
212
|
-
* 3,
|
|
213
|
-
* ); // returns `['a', 'b', 'c']`
|
|
214
|
-
* assertWrap.isLengthAtLeast(
|
|
215
|
-
* [
|
|
216
|
-
* 'a',
|
|
217
|
-
* 'b',
|
|
218
|
-
* ],
|
|
219
|
-
* 3,
|
|
220
|
-
* ); // throws an error
|
|
118
|
+
* assertWrap.isLengthAtLeast(['a', 'b', 'c'], 2); // returns `['a', 'b', 'c']`
|
|
119
|
+
* assertWrap.isLengthAtLeast(['a', 'b', 'c'], 3); // returns `['a', 'b', 'c']`
|
|
120
|
+
* assertWrap.isLengthAtLeast(['a', 'b'], 3); // throws an error
|
|
221
121
|
* ```
|
|
222
122
|
*
|
|
223
123
|
* @returns The value if it has at least the given length.
|
|
@@ -237,29 +137,9 @@ export declare const lengthGuards: {
|
|
|
237
137
|
* ```ts
|
|
238
138
|
* import {assertWrap} from '@augment-vir/assert';
|
|
239
139
|
*
|
|
240
|
-
* assertWrap.isLengthExactly(
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* 'b',
|
|
244
|
-
* 'c',
|
|
245
|
-
* ],
|
|
246
|
-
* 2,
|
|
247
|
-
* ); // throws an error
|
|
248
|
-
* assertWrap.isLengthExactly(
|
|
249
|
-
* [
|
|
250
|
-
* 'a',
|
|
251
|
-
* 'b',
|
|
252
|
-
* 'c',
|
|
253
|
-
* ],
|
|
254
|
-
* 3,
|
|
255
|
-
* ); // returns `['a', 'b', 'c']`
|
|
256
|
-
* assertWrap.isLengthExactly(
|
|
257
|
-
* [
|
|
258
|
-
* 'a',
|
|
259
|
-
* 'b',
|
|
260
|
-
* ],
|
|
261
|
-
* 3,
|
|
262
|
-
* ); // throws an error
|
|
140
|
+
* assertWrap.isLengthExactly(['a', 'b', 'c'], 2); // throws an error
|
|
141
|
+
* assertWrap.isLengthExactly(['a', 'b', 'c'], 3); // returns `['a', 'b', 'c']`
|
|
142
|
+
* assertWrap.isLengthExactly(['a', 'b'], 3); // throws an error
|
|
263
143
|
* ```
|
|
264
144
|
*
|
|
265
145
|
* @returns The value if it has exactly the given length.
|
|
@@ -281,29 +161,9 @@ export declare const lengthGuards: {
|
|
|
281
161
|
* ```ts
|
|
282
162
|
* import {checkWrap} from '@augment-vir/assert';
|
|
283
163
|
*
|
|
284
|
-
* checkWrap.isLengthAtLeast(
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
* 'b',
|
|
288
|
-
* 'c',
|
|
289
|
-
* ],
|
|
290
|
-
* 2,
|
|
291
|
-
* ); // returns `['a', 'b', 'c']`
|
|
292
|
-
* checkWrap.isLengthAtLeast(
|
|
293
|
-
* [
|
|
294
|
-
* 'a',
|
|
295
|
-
* 'b',
|
|
296
|
-
* 'c',
|
|
297
|
-
* ],
|
|
298
|
-
* 3,
|
|
299
|
-
* ); // returns `['a', 'b', 'c']`
|
|
300
|
-
* checkWrap.isLengthAtLeast(
|
|
301
|
-
* [
|
|
302
|
-
* 'a',
|
|
303
|
-
* 'b',
|
|
304
|
-
* ],
|
|
305
|
-
* 3,
|
|
306
|
-
* ); // returns `undefined`
|
|
164
|
+
* checkWrap.isLengthAtLeast(['a', 'b', 'c'], 2); // returns `['a', 'b', 'c']`
|
|
165
|
+
* checkWrap.isLengthAtLeast(['a', 'b', 'c'], 3); // returns `['a', 'b', 'c']`
|
|
166
|
+
* checkWrap.isLengthAtLeast(['a', 'b'], 3); // returns `undefined`
|
|
307
167
|
* ```
|
|
308
168
|
*
|
|
309
169
|
* @returns The value if the check passes, otherwise `undefined`.
|
|
@@ -322,29 +182,9 @@ export declare const lengthGuards: {
|
|
|
322
182
|
* ```ts
|
|
323
183
|
* import {checkWrap} from '@augment-vir/assert';
|
|
324
184
|
*
|
|
325
|
-
* checkWrap.isLengthExactly(
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
* 'b',
|
|
329
|
-
* 'c',
|
|
330
|
-
* ],
|
|
331
|
-
* 2,
|
|
332
|
-
* ); // returns `undefined`
|
|
333
|
-
* checkWrap.isLengthExactly(
|
|
334
|
-
* [
|
|
335
|
-
* 'a',
|
|
336
|
-
* 'b',
|
|
337
|
-
* 'c',
|
|
338
|
-
* ],
|
|
339
|
-
* 3,
|
|
340
|
-
* ); // returns `['a', 'b', 'c']`
|
|
341
|
-
* checkWrap.isLengthExactly(
|
|
342
|
-
* [
|
|
343
|
-
* 'a',
|
|
344
|
-
* 'b',
|
|
345
|
-
* ],
|
|
346
|
-
* 3,
|
|
347
|
-
* ); // returns `undefined`
|
|
185
|
+
* checkWrap.isLengthExactly(['a', 'b', 'c'], 2); // returns `undefined`
|
|
186
|
+
* checkWrap.isLengthExactly(['a', 'b', 'c'], 3); // returns `['a', 'b', 'c']`
|
|
187
|
+
* checkWrap.isLengthExactly(['a', 'b'], 3); // returns `undefined`
|
|
348
188
|
* ```
|
|
349
189
|
*
|
|
350
190
|
* @returns The value if the check passes, otherwise `undefined`.
|
|
@@ -366,20 +206,9 @@ export declare const lengthGuards: {
|
|
|
366
206
|
* ```ts
|
|
367
207
|
* import {waitUntil} from '@augment-vir/assert';
|
|
368
208
|
*
|
|
369
|
-
* await waitUntil.isLengthAtLeast(2, () => [
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
* 'c',
|
|
373
|
-
* ]); // returns `['a', 'b', 'c']`
|
|
374
|
-
* await waitUntil.isLengthAtLeast(3, () => [
|
|
375
|
-
* 'a',
|
|
376
|
-
* 'b',
|
|
377
|
-
* 'c',
|
|
378
|
-
* ]); // returns `['a', 'b', 'c']`
|
|
379
|
-
* await waitUntil.isLengthAtLeast(3, () => [
|
|
380
|
-
* 'a',
|
|
381
|
-
* 'b',
|
|
382
|
-
* ]); // throws an error
|
|
209
|
+
* await waitUntil.isLengthAtLeast(2, () => ['a', 'b', 'c']); // returns `['a', 'b', 'c']`
|
|
210
|
+
* await waitUntil.isLengthAtLeast(3, () => ['a', 'b', 'c']); // returns `['a', 'b', 'c']`
|
|
211
|
+
* await waitUntil.isLengthAtLeast(3, () => ['a', 'b']); // throws an error
|
|
383
212
|
* ```
|
|
384
213
|
*
|
|
385
214
|
* @returns The callback output once it passes.
|
|
@@ -400,20 +229,9 @@ export declare const lengthGuards: {
|
|
|
400
229
|
* ```ts
|
|
401
230
|
* import {waitUntil} from '@augment-vir/assert';
|
|
402
231
|
*
|
|
403
|
-
* await waitUntil.isLengthAtLeast(2, () => [
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
* 'c',
|
|
407
|
-
* ]); // throws an error
|
|
408
|
-
* await waitUntil.isLengthAtLeast(3, () => [
|
|
409
|
-
* 'a',
|
|
410
|
-
* 'b',
|
|
411
|
-
* 'c',
|
|
412
|
-
* ]); // returns `['a', 'b', 'c']`
|
|
413
|
-
* await waitUntil.isLengthAtLeast(3, () => [
|
|
414
|
-
* 'a',
|
|
415
|
-
* 'b',
|
|
416
|
-
* ]); // throws an error
|
|
232
|
+
* await waitUntil.isLengthAtLeast(2, () => ['a', 'b', 'c']); // throws an error
|
|
233
|
+
* await waitUntil.isLengthAtLeast(3, () => ['a', 'b', 'c']); // returns `['a', 'b', 'c']`
|
|
234
|
+
* await waitUntil.isLengthAtLeast(3, () => ['a', 'b']); // throws an error
|
|
417
235
|
* ```
|
|
418
236
|
*
|
|
419
237
|
* @returns The callback output once it passes.
|