@augment-vir/assert 31.9.0 → 31.9.2

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.
@@ -32,9 +32,29 @@ export declare const lengthGuards: {
32
32
  * ```ts
33
33
  * import {assert} from '@augment-vir/assert';
34
34
  *
35
- * assert.isLengthAtLeast(['a', 'b', 'c'], 2); // passes
36
- * assert.isLengthAtLeast(['a', 'b', 'c'], 3); // passes
37
- * assert.isLengthAtLeast(['a', 'b'], 3); // fails
35
+ * assert.isLengthAtLeast(
36
+ * [
37
+ * 'a',
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
38
58
  * ```
39
59
  *
40
60
  * @throws {@link AssertionError} If the value is less than the given length.
@@ -52,9 +72,29 @@ export declare const lengthGuards: {
52
72
  * ```ts
53
73
  * import {assert} from '@augment-vir/assert';
54
74
  *
55
- * assert.isLengthExactly(['a', 'b', 'c'], 2); // fails
56
- * assert.isLengthExactly(['a', 'b', 'c'], 3); // passes
57
- * assert.isLengthExactly(['a', 'b'], 3); // fails
75
+ * assert.isLengthExactly(
76
+ * [
77
+ * 'a',
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
58
98
  * ```
59
99
  *
60
100
  * @throws {@link AssertionError} If the value is not exactly the given length.
@@ -74,9 +114,29 @@ export declare const lengthGuards: {
74
114
  * ```ts
75
115
  * import {check} from '@augment-vir/assert';
76
116
  *
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`
117
+ * check.isLengthAtLeast(
118
+ * [
119
+ * 'a',
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`
80
140
  * ```
81
141
  *
82
142
  * @see
@@ -93,9 +153,29 @@ export declare const lengthGuards: {
93
153
  * ```ts
94
154
  * import {check} from '@augment-vir/assert';
95
155
  *
96
- * check.isLengthExactly(['a', 'b', 'c'], 2); // fails
97
- * check.isLengthExactly(['a', 'b', 'c'], 3); // passes
98
- * check.isLengthExactly(['a', 'b'], 3); // fails
156
+ * check.isLengthExactly(
157
+ * [
158
+ * 'a',
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
99
179
  * ```
100
180
  *
101
181
  * @see
@@ -115,9 +195,29 @@ export declare const lengthGuards: {
115
195
  * ```ts
116
196
  * import {assertWrap} from '@augment-vir/assert';
117
197
  *
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
198
+ * assertWrap.isLengthAtLeast(
199
+ * [
200
+ * 'a',
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
121
221
  * ```
122
222
  *
123
223
  * @returns The value if it has at least the given length.
@@ -137,9 +237,29 @@ export declare const lengthGuards: {
137
237
  * ```ts
138
238
  * import {assertWrap} from '@augment-vir/assert';
139
239
  *
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
240
+ * assertWrap.isLengthExactly(
241
+ * [
242
+ * 'a',
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
143
263
  * ```
144
264
  *
145
265
  * @returns The value if it has exactly the given length.
@@ -161,9 +281,29 @@ export declare const lengthGuards: {
161
281
  * ```ts
162
282
  * import {checkWrap} from '@augment-vir/assert';
163
283
  *
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`
284
+ * checkWrap.isLengthAtLeast(
285
+ * [
286
+ * 'a',
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`
167
307
  * ```
168
308
  *
169
309
  * @returns The value if the check passes, otherwise `undefined`.
@@ -182,9 +322,29 @@ export declare const lengthGuards: {
182
322
  * ```ts
183
323
  * import {checkWrap} from '@augment-vir/assert';
184
324
  *
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`
325
+ * checkWrap.isLengthExactly(
326
+ * [
327
+ * 'a',
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`
188
348
  * ```
189
349
  *
190
350
  * @returns The value if the check passes, otherwise `undefined`.
@@ -206,9 +366,20 @@ export declare const lengthGuards: {
206
366
  * ```ts
207
367
  * import {waitUntil} from '@augment-vir/assert';
208
368
  *
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
369
+ * await waitUntil.isLengthAtLeast(2, () => [
370
+ * 'a',
371
+ * 'b',
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
212
383
  * ```
213
384
  *
214
385
  * @returns The callback output once it passes.
@@ -229,9 +400,20 @@ export declare const lengthGuards: {
229
400
  * ```ts
230
401
  * import {waitUntil} from '@augment-vir/assert';
231
402
  *
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
403
+ * await waitUntil.isLengthAtLeast(2, () => [
404
+ * 'a',
405
+ * 'b',
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
235
417
  * ```
236
418
  *
237
419
  * @returns The callback output once it passes.
@@ -54,9 +54,29 @@ const assertions = {
54
54
  * ```ts
55
55
  * import {assert} from '@augment-vir/assert';
56
56
  *
57
- * assert.isLengthAtLeast(['a', 'b', 'c'], 2); // passes
58
- * assert.isLengthAtLeast(['a', 'b', 'c'], 3); // passes
59
- * assert.isLengthAtLeast(['a', 'b'], 3); // fails
57
+ * assert.isLengthAtLeast(
58
+ * [
59
+ * 'a',
60
+ * 'b',
61
+ * 'c',
62
+ * ],
63
+ * 2,
64
+ * ); // passes
65
+ * assert.isLengthAtLeast(
66
+ * [
67
+ * 'a',
68
+ * 'b',
69
+ * 'c',
70
+ * ],
71
+ * 3,
72
+ * ); // passes
73
+ * assert.isLengthAtLeast(
74
+ * [
75
+ * 'a',
76
+ * 'b',
77
+ * ],
78
+ * 3,
79
+ * ); // fails
60
80
  * ```
61
81
  *
62
82
  * @throws {@link AssertionError} If the value is less than the given length.
@@ -74,9 +94,29 @@ const assertions = {
74
94
  * ```ts
75
95
  * import {assert} from '@augment-vir/assert';
76
96
  *
77
- * assert.isLengthExactly(['a', 'b', 'c'], 2); // fails
78
- * assert.isLengthExactly(['a', 'b', 'c'], 3); // passes
79
- * assert.isLengthExactly(['a', 'b'], 3); // fails
97
+ * assert.isLengthExactly(
98
+ * [
99
+ * 'a',
100
+ * 'b',
101
+ * 'c',
102
+ * ],
103
+ * 2,
104
+ * ); // fails
105
+ * assert.isLengthExactly(
106
+ * [
107
+ * 'a',
108
+ * 'b',
109
+ * 'c',
110
+ * ],
111
+ * 3,
112
+ * ); // passes
113
+ * assert.isLengthExactly(
114
+ * [
115
+ * 'a',
116
+ * 'b',
117
+ * ],
118
+ * 3,
119
+ * ); // fails
80
120
  * ```
81
121
  *
82
122
  * @throws {@link AssertionError} If the value is not exactly the given length.
@@ -98,9 +138,29 @@ export const lengthGuards = {
98
138
  * ```ts
99
139
  * import {check} from '@augment-vir/assert';
100
140
  *
101
- * check.isLengthAtLeast(['a', 'b', 'c'], 2); // returns `true`
102
- * check.isLengthAtLeast(['a', 'b', 'c'], 3); // returns `true`
103
- * check.isLengthAtLeast(['a', 'b'], 3); // returns `false`
141
+ * check.isLengthAtLeast(
142
+ * [
143
+ * 'a',
144
+ * 'b',
145
+ * 'c',
146
+ * ],
147
+ * 2,
148
+ * ); // returns `true`
149
+ * check.isLengthAtLeast(
150
+ * [
151
+ * 'a',
152
+ * 'b',
153
+ * 'c',
154
+ * ],
155
+ * 3,
156
+ * ); // returns `true`
157
+ * check.isLengthAtLeast(
158
+ * [
159
+ * 'a',
160
+ * 'b',
161
+ * ],
162
+ * 3,
163
+ * ); // returns `false`
104
164
  * ```
105
165
  *
106
166
  * @see
@@ -122,9 +182,29 @@ export const lengthGuards = {
122
182
  * ```ts
123
183
  * import {check} from '@augment-vir/assert';
124
184
  *
125
- * check.isLengthExactly(['a', 'b', 'c'], 2); // fails
126
- * check.isLengthExactly(['a', 'b', 'c'], 3); // passes
127
- * check.isLengthExactly(['a', 'b'], 3); // fails
185
+ * check.isLengthExactly(
186
+ * [
187
+ * 'a',
188
+ * 'b',
189
+ * 'c',
190
+ * ],
191
+ * 2,
192
+ * ); // fails
193
+ * check.isLengthExactly(
194
+ * [
195
+ * 'a',
196
+ * 'b',
197
+ * 'c',
198
+ * ],
199
+ * 3,
200
+ * ); // passes
201
+ * check.isLengthExactly(
202
+ * [
203
+ * 'a',
204
+ * 'b',
205
+ * ],
206
+ * 3,
207
+ * ); // fails
128
208
  * ```
129
209
  *
130
210
  * @see
@@ -149,9 +229,29 @@ export const lengthGuards = {
149
229
  * ```ts
150
230
  * import {assertWrap} from '@augment-vir/assert';
151
231
  *
152
- * assertWrap.isLengthAtLeast(['a', 'b', 'c'], 2); // returns `['a', 'b', 'c']`
153
- * assertWrap.isLengthAtLeast(['a', 'b', 'c'], 3); // returns `['a', 'b', 'c']`
154
- * assertWrap.isLengthAtLeast(['a', 'b'], 3); // throws an error
232
+ * assertWrap.isLengthAtLeast(
233
+ * [
234
+ * 'a',
235
+ * 'b',
236
+ * 'c',
237
+ * ],
238
+ * 2,
239
+ * ); // returns `['a', 'b', 'c']`
240
+ * assertWrap.isLengthAtLeast(
241
+ * [
242
+ * 'a',
243
+ * 'b',
244
+ * 'c',
245
+ * ],
246
+ * 3,
247
+ * ); // returns `['a', 'b', 'c']`
248
+ * assertWrap.isLengthAtLeast(
249
+ * [
250
+ * 'a',
251
+ * 'b',
252
+ * ],
253
+ * 3,
254
+ * ); // throws an error
155
255
  * ```
156
256
  *
157
257
  * @returns The value if it has at least the given length.
@@ -179,9 +279,29 @@ export const lengthGuards = {
179
279
  * ```ts
180
280
  * import {assertWrap} from '@augment-vir/assert';
181
281
  *
182
- * assertWrap.isLengthExactly(['a', 'b', 'c'], 2); // throws an error
183
- * assertWrap.isLengthExactly(['a', 'b', 'c'], 3); // returns `['a', 'b', 'c']`
184
- * assertWrap.isLengthExactly(['a', 'b'], 3); // throws an error
282
+ * assertWrap.isLengthExactly(
283
+ * [
284
+ * 'a',
285
+ * 'b',
286
+ * 'c',
287
+ * ],
288
+ * 2,
289
+ * ); // throws an error
290
+ * assertWrap.isLengthExactly(
291
+ * [
292
+ * 'a',
293
+ * 'b',
294
+ * 'c',
295
+ * ],
296
+ * 3,
297
+ * ); // returns `['a', 'b', 'c']`
298
+ * assertWrap.isLengthExactly(
299
+ * [
300
+ * 'a',
301
+ * 'b',
302
+ * ],
303
+ * 3,
304
+ * ); // throws an error
185
305
  * ```
186
306
  *
187
307
  * @returns The value if it has exactly the given length.
@@ -211,9 +331,29 @@ export const lengthGuards = {
211
331
  * ```ts
212
332
  * import {checkWrap} from '@augment-vir/assert';
213
333
  *
214
- * checkWrap.isLengthAtLeast(['a', 'b', 'c'], 2); // returns `['a', 'b', 'c']`
215
- * checkWrap.isLengthAtLeast(['a', 'b', 'c'], 3); // returns `['a', 'b', 'c']`
216
- * checkWrap.isLengthAtLeast(['a', 'b'], 3); // returns `undefined`
334
+ * checkWrap.isLengthAtLeast(
335
+ * [
336
+ * 'a',
337
+ * 'b',
338
+ * 'c',
339
+ * ],
340
+ * 2,
341
+ * ); // returns `['a', 'b', 'c']`
342
+ * checkWrap.isLengthAtLeast(
343
+ * [
344
+ * 'a',
345
+ * 'b',
346
+ * 'c',
347
+ * ],
348
+ * 3,
349
+ * ); // returns `['a', 'b', 'c']`
350
+ * checkWrap.isLengthAtLeast(
351
+ * [
352
+ * 'a',
353
+ * 'b',
354
+ * ],
355
+ * 3,
356
+ * ); // returns `undefined`
217
357
  * ```
218
358
  *
219
359
  * @returns The value if the check passes, otherwise `undefined`.
@@ -242,9 +382,29 @@ export const lengthGuards = {
242
382
  * ```ts
243
383
  * import {checkWrap} from '@augment-vir/assert';
244
384
  *
245
- * checkWrap.isLengthExactly(['a', 'b', 'c'], 2); // returns `undefined`
246
- * checkWrap.isLengthExactly(['a', 'b', 'c'], 3); // returns `['a', 'b', 'c']`
247
- * checkWrap.isLengthExactly(['a', 'b'], 3); // returns `undefined`
385
+ * checkWrap.isLengthExactly(
386
+ * [
387
+ * 'a',
388
+ * 'b',
389
+ * 'c',
390
+ * ],
391
+ * 2,
392
+ * ); // returns `undefined`
393
+ * checkWrap.isLengthExactly(
394
+ * [
395
+ * 'a',
396
+ * 'b',
397
+ * 'c',
398
+ * ],
399
+ * 3,
400
+ * ); // returns `['a', 'b', 'c']`
401
+ * checkWrap.isLengthExactly(
402
+ * [
403
+ * 'a',
404
+ * 'b',
405
+ * ],
406
+ * 3,
407
+ * ); // returns `undefined`
248
408
  * ```
249
409
  *
250
410
  * @returns The value if the check passes, otherwise `undefined`.
@@ -276,9 +436,20 @@ export const lengthGuards = {
276
436
  * ```ts
277
437
  * import {waitUntil} from '@augment-vir/assert';
278
438
  *
279
- * await waitUntil.isLengthAtLeast(2, () => ['a', 'b', 'c']); // returns `['a', 'b', 'c']`
280
- * await waitUntil.isLengthAtLeast(3, () => ['a', 'b', 'c']); // returns `['a', 'b', 'c']`
281
- * await waitUntil.isLengthAtLeast(3, () => ['a', 'b']); // throws an error
439
+ * await waitUntil.isLengthAtLeast(2, () => [
440
+ * 'a',
441
+ * 'b',
442
+ * 'c',
443
+ * ]); // returns `['a', 'b', 'c']`
444
+ * await waitUntil.isLengthAtLeast(3, () => [
445
+ * 'a',
446
+ * 'b',
447
+ * 'c',
448
+ * ]); // returns `['a', 'b', 'c']`
449
+ * await waitUntil.isLengthAtLeast(3, () => [
450
+ * 'a',
451
+ * 'b',
452
+ * ]); // throws an error
282
453
  * ```
283
454
  *
284
455
  * @returns The callback output once it passes.
@@ -299,9 +470,20 @@ export const lengthGuards = {
299
470
  * ```ts
300
471
  * import {waitUntil} from '@augment-vir/assert';
301
472
  *
302
- * await waitUntil.isLengthAtLeast(2, () => ['a', 'b', 'c']); // throws an error
303
- * await waitUntil.isLengthAtLeast(3, () => ['a', 'b', 'c']); // returns `['a', 'b', 'c']`
304
- * await waitUntil.isLengthAtLeast(3, () => ['a', 'b']); // throws an error
473
+ * await waitUntil.isLengthAtLeast(2, () => [
474
+ * 'a',
475
+ * 'b',
476
+ * 'c',
477
+ * ]); // throws an error
478
+ * await waitUntil.isLengthAtLeast(3, () => [
479
+ * 'a',
480
+ * 'b',
481
+ * 'c',
482
+ * ]); // returns `['a', 'b', 'c']`
483
+ * await waitUntil.isLengthAtLeast(3, () => [
484
+ * 'a',
485
+ * 'b',
486
+ * ]); // throws an error
305
487
  * ```
306
488
  *
307
489
  * @returns The callback output once it passes.
@@ -23,7 +23,13 @@ function extractOutputArgs(functionToCallOrAsserter, inputsOrFunctionToCall, exp
23
23
  const failureMessage = usingCustomAsserter
24
24
  ? emptyOrFailureMessage
25
25
  : failureMessageOrExpectedOutput;
26
- return [asserter, functionToCall, inputs, expectedOutput, failureMessage];
26
+ return [
27
+ asserter,
28
+ functionToCall,
29
+ inputs,
30
+ expectedOutput,
31
+ failureMessage,
32
+ ];
27
33
  }
28
34
  function innerAssertOutput(asserter, functionToCall, inputs, expectedOutput, failureMessage, shouldReturnResult) {
29
35
  const result = functionToCall(...inputs);