@noeldemartin/utils 0.7.2 → 0.7.3-next.06f5fc5dd2d541f993296ffca3b64a7ad51519a8
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/noeldemartin-utils.d.ts +664 -871
- package/dist/noeldemartin-utils.js +1684 -1420
- package/dist/noeldemartin-utils.js.map +1 -1
- package/package.json +38 -51
- package/src/fluent/FluentArray.test.ts +2 -9
- package/src/fluent/FluentArray.ts +3 -5
- package/src/fluent/FluentObject.ts +2 -4
- package/src/fluent/FluentString.test.ts +1 -8
- package/src/fluent/FluentString.ts +0 -2
- package/src/fluent/facade.test.ts +1 -5
- package/src/fluent/facade.ts +1 -1
- package/src/fluent/index.test.ts +3 -8
- package/src/fluent/index.ts +3 -3
- package/src/fluent/invade.test.ts +15 -0
- package/src/fluent/invade.ts +9 -0
- package/src/fluent/required.test.ts +1 -5
- package/src/fluent/required.ts +2 -4
- package/src/fluent/tap.test.ts +2 -9
- package/src/fluent/tap.ts +4 -3
- package/src/fluent/value.test.ts +1 -4
- package/src/fluent/when.test.ts +1 -6
- package/src/fluent/when.ts +2 -2
- package/src/helpers/IndexedDBMap.ts +0 -2
- package/src/helpers/JSError.test.ts +1 -6
- package/src/helpers/JSError.ts +0 -2
- package/src/helpers/ListenersManager.test.ts +3 -7
- package/src/helpers/ListenersManager.ts +2 -4
- package/src/helpers/MagicObject.test.ts +2 -9
- package/src/helpers/MagicObject.ts +1 -3
- package/src/helpers/ObjectsMap.test.ts +1 -3
- package/src/helpers/ObjectsMap.ts +1 -5
- package/src/helpers/PromisedValue.test.ts +1 -3
- package/src/helpers/PromisedValue.ts +4 -5
- package/src/helpers/Semaphore.test.ts +6 -10
- package/src/helpers/Semaphore.ts +0 -2
- package/src/helpers/Storage.ts +0 -2
- package/src/helpers/array_helpers.test.ts +103 -38
- package/src/helpers/array_helpers.ts +81 -33
- package/src/helpers/caching_helpers.test.ts +1 -3
- package/src/helpers/caching_helpers.ts +2 -2
- package/src/helpers/date_helpers.test.ts +1 -4
- package/src/helpers/date_helpers.ts +1 -1
- package/src/helpers/env.ts +5 -1
- package/src/helpers/error_helpers.test.ts +9 -8
- package/src/helpers/error_helpers.ts +11 -11
- package/src/helpers/format_helpers.test.ts +2 -4
- package/src/helpers/hash_helpers.test.ts +1 -4
- package/src/helpers/hash_helpers.ts +3 -3
- package/src/helpers/identity_helpers.test.ts +1 -3
- package/src/helpers/index.ts +2 -0
- package/src/helpers/logical_helpers.test.ts +1 -3
- package/src/helpers/logical_helpers.ts +1 -1
- package/src/helpers/math_helpers.test.ts +1 -3
- package/src/helpers/mixin_helpers.stubs.ts +1 -13
- package/src/helpers/mixin_helpers.test.ts +2 -7
- package/src/helpers/mixin_helpers.ts +6 -9
- package/src/helpers/object_helpers.test.ts +58 -21
- package/src/helpers/object_helpers.ts +112 -24
- package/src/helpers/promise_helpers.test.ts +1 -4
- package/src/helpers/promise_helpers.ts +9 -9
- package/src/helpers/replacements-scope.ts +15 -0
- package/src/helpers/replacements.test.ts +23 -0
- package/src/helpers/replacements.ts +52 -0
- package/src/helpers/runtime_helpers.ts +3 -3
- package/src/helpers/string_helpers.test.ts +3 -5
- package/src/helpers/string_helpers.ts +5 -3
- package/src/helpers/time_constants.ts +13 -0
- package/src/helpers/time_helpers.ts +6 -0
- package/src/helpers/url_helpers.test.ts +12 -4
- package/src/helpers/url_helpers.ts +16 -14
- package/src/helpers/value_helpers.test.ts +12 -0
- package/src/helpers/value_helpers.ts +6 -0
- package/src/types/arrays.test.ts +1 -4
- package/src/types/classes.ts +1 -0
- package/src/types/helpers.test.ts +1 -6
- package/src/types/helpers.ts +9 -7
- package/src/types/objects.test.ts +3 -4
- package/src/types/objects.ts +15 -6
|
@@ -1,871 +1,664 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export declare
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export declare
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export
|
|
50
|
-
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
export
|
|
58
|
-
|
|
59
|
-
export
|
|
60
|
-
|
|
61
|
-
export
|
|
62
|
-
|
|
63
|
-
export
|
|
64
|
-
|
|
65
|
-
export
|
|
66
|
-
|
|
67
|
-
export
|
|
68
|
-
|
|
69
|
-
export
|
|
70
|
-
|
|
71
|
-
export
|
|
72
|
-
|
|
73
|
-
export
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
export
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
export
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
export
|
|
143
|
-
|
|
144
|
-
export
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
export declare
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
export declare
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
export declare
|
|
244
|
-
|
|
245
|
-
export declare
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
export declare
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
export declare
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
export
|
|
265
|
-
|
|
266
|
-
export
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
export declare
|
|
281
|
-
|
|
282
|
-
export declare function
|
|
283
|
-
|
|
284
|
-
export declare function
|
|
285
|
-
|
|
286
|
-
export declare function
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
export declare function
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
export
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
export
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
export
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
export
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
export
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
export declare
|
|
321
|
-
|
|
322
|
-
export declare type
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
export declare
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
export declare
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
export declare
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
export declare
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
export declare
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
export
|
|
376
|
-
|
|
377
|
-
export declare
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
export declare
|
|
382
|
-
|
|
383
|
-
export declare function
|
|
384
|
-
|
|
385
|
-
export declare function
|
|
386
|
-
|
|
387
|
-
export declare function
|
|
388
|
-
|
|
389
|
-
export declare function
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
export
|
|
396
|
-
|
|
397
|
-
export
|
|
398
|
-
|
|
399
|
-
export
|
|
400
|
-
|
|
401
|
-
export
|
|
402
|
-
|
|
403
|
-
export declare function
|
|
404
|
-
|
|
405
|
-
export declare function
|
|
406
|
-
|
|
407
|
-
export declare function
|
|
408
|
-
|
|
409
|
-
export declare
|
|
410
|
-
|
|
411
|
-
export declare function
|
|
412
|
-
|
|
413
|
-
export declare function
|
|
414
|
-
|
|
415
|
-
export declare
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
export declare
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
export declare
|
|
428
|
-
|
|
429
|
-
}[
|
|
430
|
-
|
|
431
|
-
export declare
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
export declare
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
export declare
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
export declare
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
export declare
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
export declare
|
|
471
|
-
|
|
472
|
-
export declare
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
export declare
|
|
478
|
-
|
|
479
|
-
export declare
|
|
480
|
-
|
|
481
|
-
export declare
|
|
482
|
-
|
|
483
|
-
export declare
|
|
484
|
-
|
|
485
|
-
export declare
|
|
486
|
-
|
|
487
|
-
export declare
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
export
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
export
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
export declare function
|
|
502
|
-
|
|
503
|
-
export declare function
|
|
504
|
-
|
|
505
|
-
export declare function
|
|
506
|
-
|
|
507
|
-
export declare function
|
|
508
|
-
|
|
509
|
-
export declare function
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
export declare
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
export declare
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
export declare
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
export
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
export declare function
|
|
618
|
-
|
|
619
|
-
export declare function
|
|
620
|
-
|
|
621
|
-
export declare function
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
export declare
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
export declare
|
|
655
|
-
|
|
656
|
-
export declare
|
|
657
|
-
|
|
658
|
-
export declare
|
|
659
|
-
|
|
660
|
-
export declare function
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
export declare function randomInt(max: number): number;
|
|
667
|
-
|
|
668
|
-
export declare function randomInt(min: number, max: number): number;
|
|
669
|
-
|
|
670
|
-
export declare function range(length: number): number[];
|
|
671
|
-
|
|
672
|
-
export declare type ReplaceConstructorArgs<T, Args extends ClosureArgs> = T extends {
|
|
673
|
-
new (...args: ClosureArgs): infer Instance;
|
|
674
|
-
} ? Omit<T, 'new'> & {
|
|
675
|
-
new (...args: Args): Instance;
|
|
676
|
-
} : never;
|
|
677
|
-
|
|
678
|
-
/**
|
|
679
|
-
* @deprecated use ReplaceValues<T, null | undefined> instead.
|
|
680
|
-
*/
|
|
681
|
-
export declare type ReplaceEmpty<T> = {
|
|
682
|
-
[K in keyof T]: ValueWithoutEmpty<T[K]>;
|
|
683
|
-
};
|
|
684
|
-
|
|
685
|
-
export declare type ReplaceValues<TObj, TExclude> = {
|
|
686
|
-
[K in keyof TObj]: ValueWithout<TObj[K], TExclude>;
|
|
687
|
-
};
|
|
688
|
-
|
|
689
|
-
export declare function required<T extends object | null | undefined>(getValue: () => T, errorMessage?: string): NonNullable<T>;
|
|
690
|
-
|
|
691
|
-
export declare function required<T>(value: T, errorMessage?: string): NonNullable<T>;
|
|
692
|
-
|
|
693
|
-
export declare type RequiredTuple<Item, Length extends number> = Length extends Length ? number extends Length ? Item[] : _RequiredTupleRecursion<Item, Length, []> : never;
|
|
694
|
-
|
|
695
|
-
export declare type _RequiredTupleRecursion<Item, Length extends number, Rest extends unknown[]> = Rest['length'] extends Length ? Rest : _RequiredTupleRecursion<Item, Length, [Item, ...Rest]>;
|
|
696
|
-
|
|
697
|
-
export declare function requireUrlDirectoryName(url: string): string;
|
|
698
|
-
|
|
699
|
-
export declare function requireUrlParentDirectory(url: string): string;
|
|
700
|
-
|
|
701
|
-
export declare function requireUrlParse(url: string): UrlParts;
|
|
702
|
-
|
|
703
|
-
export declare function resetAsyncMemo(key?: string): void;
|
|
704
|
-
|
|
705
|
-
export declare function resetMemo(key?: string): void;
|
|
706
|
-
|
|
707
|
-
export declare function resetWeakMemo(name: string, key: object): void;
|
|
708
|
-
|
|
709
|
-
export declare function round(value: number, places?: number): number;
|
|
710
|
-
|
|
711
|
-
export declare const RuntimeErrorClass: ErrorConstructor;
|
|
712
|
-
|
|
713
|
-
export declare function runtimeGlobal<T = any>(): T;
|
|
714
|
-
|
|
715
|
-
export declare function seconds(time?: Date | number, round?: boolean): number;
|
|
716
|
-
|
|
717
|
-
export declare class Semaphore {
|
|
718
|
-
private count;
|
|
719
|
-
private listeners;
|
|
720
|
-
constructor(count?: number);
|
|
721
|
-
acquire(): Promise<void>;
|
|
722
|
-
release(): void;
|
|
723
|
-
isAvailable(): boolean;
|
|
724
|
-
run<T>(operation: () => Promise<T>): Promise<T>;
|
|
725
|
-
private waitAvailable;
|
|
726
|
-
private notifyAvailable;
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
export declare function setAsyncMemo(key: string, value: unknown): void;
|
|
730
|
-
|
|
731
|
-
export declare function setMemo(key: string, value: unknown): void;
|
|
732
|
-
|
|
733
|
-
export declare function setWeakMemo(name: string, key: object, value: unknown): void;
|
|
734
|
-
|
|
735
|
-
export declare function shortId(length?: number): string;
|
|
736
|
-
|
|
737
|
-
export declare function silenced<Args extends ClosureArgs, Result>(operation: Closure<Args, Promise<Result>>): Closure<Args, Promise<Result | null>>;
|
|
738
|
-
|
|
739
|
-
export declare function silenced<Args extends ClosureArgs, Result, Default>(operation: Closure<Args, Promise<Result>>, defaultValue: Default): Closure<Args, Promise<Result | Default>>;
|
|
740
|
-
|
|
741
|
-
export declare function silenced<Result>(promise: Promise<Result>): Promise<Result | null>;
|
|
742
|
-
|
|
743
|
-
export declare function silenced<Args extends ClosureArgs, Result, Default>(operation: Closure<Args, Promise<Result>>, defaultValue: Default): Closure<Args, Promise<Result | Default>>;
|
|
744
|
-
|
|
745
|
-
declare const Storage_2: StorageSingleton;
|
|
746
|
-
export { Storage_2 as Storage }
|
|
747
|
-
|
|
748
|
-
export declare class StorageSingleton {
|
|
749
|
-
private static _instance;
|
|
750
|
-
static get instance(): StorageSingleton;
|
|
751
|
-
private constructor();
|
|
752
|
-
set<T = unknown>(key: string, value: T): void;
|
|
753
|
-
get<T>(key: string): T | null;
|
|
754
|
-
get<T>(key: string, defaultValue: T): T;
|
|
755
|
-
require<T>(key: string): T;
|
|
756
|
-
has(key: string): boolean;
|
|
757
|
-
remove(key: string): void;
|
|
758
|
-
pull<T>(key: string): T | null;
|
|
759
|
-
pull<T>(key: string, defaultValue: T): T;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
export declare function str(value?: string): FluentStringInstance<FluentStringDefinition>;
|
|
763
|
-
|
|
764
|
-
export declare function stringCapitalize(text: string): string;
|
|
765
|
-
|
|
766
|
-
export declare function stringExcerpt(text: string, maxLength?: number, filler?: string): string;
|
|
767
|
-
|
|
768
|
-
export declare function stringMatch<Length extends number, Optional extends number = number>(text: string, pattern: RegExp): Tuple<ArrayItem<RegExpMatchArray>, Length, Optional> | null;
|
|
769
|
-
|
|
770
|
-
export declare function stringMatchAll<Length extends number, Optional extends number = number>(text: string, pattern: RegExp): IterableIterator<Tuple<ArrayItem<RegExpMatchArray>, Length, Optional>>;
|
|
771
|
-
|
|
772
|
-
export declare function stringReverse(text: string): string;
|
|
773
|
-
|
|
774
|
-
export declare function stringSplitWords(text: string): string[];
|
|
775
|
-
|
|
776
|
-
export declare function stringToCamelCase(text: string): string;
|
|
777
|
-
|
|
778
|
-
export declare function stringToSlug(text: string, separator?: string): string;
|
|
779
|
-
|
|
780
|
-
export declare function stringToStudlyCase(text: string): string;
|
|
781
|
-
|
|
782
|
-
export declare function stringToTitleCase(text: string): string;
|
|
783
|
-
|
|
784
|
-
export declare function stringTrimmed(text: string): string;
|
|
785
|
-
|
|
786
|
-
export declare type SubPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
787
|
-
|
|
788
|
-
export declare function tap<Target extends object>(target: Target): Tapped<Target>;
|
|
789
|
-
|
|
790
|
-
export declare function tap<Target>(target: Target, callback: (target: Target) => Promise<unknown>): Promise<Target>;
|
|
791
|
-
|
|
792
|
-
export declare function tap<Target>(target: Target, callback: (target: Target) => unknown): Target;
|
|
793
|
-
|
|
794
|
-
export declare type Tapped<Target extends object> = {
|
|
795
|
-
[prop in keyof Target]: Target[prop] extends (...params: infer Params) => unknown ? (...params: Params) => Tapped<Target> : Target[prop];
|
|
796
|
-
};
|
|
797
|
-
|
|
798
|
-
export declare function toError(value: unknown): Error;
|
|
799
|
-
|
|
800
|
-
declare function toString_2(value: unknown): string;
|
|
801
|
-
export { toString_2 as toString }
|
|
802
|
-
|
|
803
|
-
export declare type Tuple<Item, Length extends number, Optional extends number = number> = CollapseTupleUnion<_TupleRecursion<RequiredTuple<Item, Length>, Optional, []>>;
|
|
804
|
-
|
|
805
|
-
export declare type _TupleRecursion<Tuple extends unknown[], Optional extends number, Rest extends unknown[]> = Tuple['length'] extends Rest['length'] ? Rest : Optional extends Rest['length'] ? _TupleRecursion<Tuple, Optional, [Tuple[Rest['length']] | undefined, ...Rest]> : _TupleRecursion<Tuple, Optional, [Tuple[Rest['length']], ...Rest]>;
|
|
806
|
-
|
|
807
|
-
export declare type TypeGuard<T = unknown> = (value: unknown) => value is T;
|
|
808
|
-
|
|
809
|
-
export declare function updateLocationQueryParameters(parameters: Record<string, string | undefined>): Promise<void>;
|
|
810
|
-
|
|
811
|
-
export declare function urlClean(url: string, includedParts: {
|
|
812
|
-
[part in keyof UrlParts]?: boolean;
|
|
813
|
-
}): string;
|
|
814
|
-
|
|
815
|
-
export declare function urlDirectoryName(url: string): string | null;
|
|
816
|
-
|
|
817
|
-
export declare function urlFileName(url: string): string;
|
|
818
|
-
|
|
819
|
-
export declare function urlParentDirectory(url: string): string | null;
|
|
820
|
-
|
|
821
|
-
export declare function urlParse(url: string): UrlParts | null;
|
|
822
|
-
|
|
823
|
-
export declare interface UrlParts {
|
|
824
|
-
protocol?: string;
|
|
825
|
-
domain?: string;
|
|
826
|
-
port?: string;
|
|
827
|
-
path?: string;
|
|
828
|
-
query?: string;
|
|
829
|
-
fragment?: string;
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
export declare function urlResolve(...parts: string[]): string;
|
|
833
|
-
|
|
834
|
-
export declare function urlResolveDirectory(...parts: string[]): string;
|
|
835
|
-
|
|
836
|
-
export declare function urlRoot(url: string): string;
|
|
837
|
-
|
|
838
|
-
export declare function urlRoute(url: string): string;
|
|
839
|
-
|
|
840
|
-
export declare type Use<T> = {};
|
|
841
|
-
|
|
842
|
-
export declare function usesMixin(target: any, mixin: Constructor): boolean;
|
|
843
|
-
|
|
844
|
-
export declare function uuid(): string;
|
|
845
|
-
|
|
846
|
-
export declare function value<T>(evaluator: () => T): T;
|
|
847
|
-
|
|
848
|
-
export declare function value<T>(evaluator: T): T;
|
|
849
|
-
|
|
850
|
-
export declare type ValueWithout<TValue, TExclude> = TValue extends TExclude ? never : TValue;
|
|
851
|
-
|
|
852
|
-
/**
|
|
853
|
-
* @deprecated use NonNullable<T> instead.
|
|
854
|
-
*/
|
|
855
|
-
export declare type ValueWithoutEmpty<T> = T extends null | undefined ? never : T;
|
|
856
|
-
|
|
857
|
-
export declare type VoidClosure<T> = T extends (...args: infer A) => ClosureResult ? (...args: A) => void : never;
|
|
858
|
-
|
|
859
|
-
export declare function weakMemo<T>(name: string, key: object, operation: () => T): T;
|
|
860
|
-
|
|
861
|
-
export declare function when<T extends object>(target: T, condition: () => boolean): T;
|
|
862
|
-
|
|
863
|
-
export declare function when<T extends object>(target: T, condition: boolean): T;
|
|
864
|
-
|
|
865
|
-
export declare function when<T extends object>(target: any, condition: (t: any) => t is T): T;
|
|
866
|
-
|
|
867
|
-
export declare type Writable<T> = {
|
|
868
|
-
-readonly [K in keyof T]: T[K];
|
|
869
|
-
};
|
|
870
|
-
|
|
871
|
-
export { }
|
|
1
|
+
//#region src/helpers/IndexedDBMap.d.ts
|
|
2
|
+
declare class IndexedDBMap<TItem> {
|
|
3
|
+
private db;
|
|
4
|
+
private namespace;
|
|
5
|
+
constructor(namespace: string);
|
|
6
|
+
has(key: string): Promise<boolean>;
|
|
7
|
+
get(key: string): Promise<TItem | undefined>;
|
|
8
|
+
require(key: string): Promise<TItem>;
|
|
9
|
+
set(key: string, value: TItem): Promise<void>;
|
|
10
|
+
delete(key: string): Promise<void>;
|
|
11
|
+
clear(): Promise<void>;
|
|
12
|
+
close(): void;
|
|
13
|
+
private getConnection;
|
|
14
|
+
private connect;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/helpers/JSError.d.ts
|
|
18
|
+
export declare const RuntimeErrorClass: ErrorConstructor;
|
|
19
|
+
export interface JSErrorOptions {
|
|
20
|
+
cause?: unknown;
|
|
21
|
+
}
|
|
22
|
+
declare class JSError extends RuntimeErrorClass {
|
|
23
|
+
name: string;
|
|
24
|
+
message: string;
|
|
25
|
+
stack?: string;
|
|
26
|
+
cause?: unknown;
|
|
27
|
+
constructor(message?: string, options?: JSErrorOptions);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/helpers/ListenersManager.d.ts
|
|
31
|
+
export type ListenerEvents<TListener extends object> = Required<{ [K in keyof TListener]: NonNullable<TListener[K]> extends ((...args: any[]) => any) ? K : never; }>[keyof TListener];
|
|
32
|
+
export type ListenerPayload<TListener extends object, TEvent extends keyof TListener> = Required<{ [K in keyof TListener]: NonNullable<TListener[K]> extends ((...args: infer TPayload) => any) ? TPayload : never; }>[TEvent];
|
|
33
|
+
export interface Listeners<Listener extends object> {
|
|
34
|
+
add(listener: Listener): () => void;
|
|
35
|
+
remove(listener: Listener): void;
|
|
36
|
+
}
|
|
37
|
+
declare class ListenersManager<Listener extends object> implements Listeners<Listener> {
|
|
38
|
+
private listeners;
|
|
39
|
+
add(listener: Listener): () => void;
|
|
40
|
+
remove(listener: Listener): void;
|
|
41
|
+
emit<Event extends ListenerEvents<Listener>>(event: Event, ...payload: ListenerPayload<Listener, Event>): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/types/helpers.d.ts
|
|
45
|
+
export declare const __brand: unique symbol;
|
|
46
|
+
export type ClassInstance<Class> = Class extends {
|
|
47
|
+
new (...args: any[]): infer T;
|
|
48
|
+
} ? T : never;
|
|
49
|
+
export type Closure<Args extends ClosureArgs = ClosureArgs, Result = unknown> = (...args: Args) => Result;
|
|
50
|
+
export type ClosureArgs = any[];
|
|
51
|
+
export type ClosureResult = any;
|
|
52
|
+
export type Branded<T, Brand> = T & {
|
|
53
|
+
[__brand]: Brand;
|
|
54
|
+
};
|
|
55
|
+
export type Equals<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
|
|
56
|
+
export type Falsy = '' | null | undefined | false | 0;
|
|
57
|
+
export type Truthy<T> = Exclude<T, Falsy>;
|
|
58
|
+
export type GetObjectMethods<T> = { [K in keyof T]: T[K] extends ((...args: ClosureArgs) => ClosureResult) ? K : never; }[keyof T];
|
|
59
|
+
export type GetOptionalKeys<T> = { [K in keyof T]-?: Record<string, never> extends Pick<T, K> ? K : never; }[keyof T];
|
|
60
|
+
export type GetRequiredKeys<T> = { [K in keyof T]-?: T extends Record<K, T[K]> ? K : never; }[keyof T];
|
|
61
|
+
export type KeyOf<Object, Values> = { [k in keyof Object]: Object[k] extends Values ? k : never; }[keyof Object];
|
|
62
|
+
export type Nullable<T> = T | null | undefined;
|
|
63
|
+
export type NullableOptional<T> = Pretty<{ [P in GetOptionalKeys<T>]?: Nullable<T[P]>; } & { [P in GetRequiredKeys<T>]: T[P]; }>;
|
|
64
|
+
export type NullablePartial<T> = { [P in keyof T]?: Nullable<T[P]>; };
|
|
65
|
+
export type ObjectValues<T> = T[keyof T];
|
|
66
|
+
export type OnlyKnownProperties<TGeneric, TKnown> = { [K in keyof TGeneric]: K extends keyof TKnown ? TGeneric[K] : never; };
|
|
67
|
+
export type Override<T, TOverrides> = Omit<T, keyof TOverrides> & TOverrides;
|
|
68
|
+
export type Pretty<T> = T extends (infer U) ? { [K in keyof U]: U[K]; } : never;
|
|
69
|
+
export type SubPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
70
|
+
export type TypeGuard<T = unknown> = (value: unknown) => value is T;
|
|
71
|
+
export type VoidClosure<T> = T extends ((...args: infer A) => ClosureResult) ? (...args: A) => void : never;
|
|
72
|
+
export type Writable<T> = { -readonly [K in keyof T]: T[K]; };
|
|
73
|
+
export type IsAny<T> = {
|
|
74
|
+
__: 'never';
|
|
75
|
+
} extends T ? true : false;
|
|
76
|
+
export type IsPlainObject<T> = T extends object ? T extends Function ? false : T extends any[] ? false : T extends Date ? false : T extends RegExp ? false : true : false;
|
|
77
|
+
export type Use<T> = {};
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/types/classes.d.ts
|
|
80
|
+
export interface Constructor<T = Object> {
|
|
81
|
+
new (...args: any[]): T;
|
|
82
|
+
}
|
|
83
|
+
export type ReplaceConstructorArgs<T, Args extends ClosureArgs> = T extends {
|
|
84
|
+
new (...args: ClosureArgs): infer Instance;
|
|
85
|
+
} ? Omit<T, 'new'> & {
|
|
86
|
+
new (...args: Args): Instance;
|
|
87
|
+
} : never;
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/helpers/MagicObject.d.ts
|
|
90
|
+
export interface MagicObjectProxy<T> {
|
|
91
|
+
target: T;
|
|
92
|
+
instance: T;
|
|
93
|
+
}
|
|
94
|
+
export type MagicObjectConstructor<T extends MagicObject = MagicObject> = Constructor<T> & typeof MagicObject;
|
|
95
|
+
declare class MagicObject {
|
|
96
|
+
private static __conjuring;
|
|
97
|
+
private static __reservedProperties;
|
|
98
|
+
protected static isConjuring(): boolean;
|
|
99
|
+
private static isMagicReady;
|
|
100
|
+
private static prepareMagic;
|
|
101
|
+
protected static isReservedProperty(property: string): boolean;
|
|
102
|
+
protected _proxy: MagicObjectProxy<this>;
|
|
103
|
+
constructor(...args: ClosureArgs);
|
|
104
|
+
static<T extends typeof MagicObject>(): T;
|
|
105
|
+
static<T extends typeof MagicObject, K extends keyof T>(property: K): T[K];
|
|
106
|
+
protected reserveProperty(property: string): void;
|
|
107
|
+
protected initialize(...args: ClosureArgs): void;
|
|
108
|
+
protected __get(property: string): unknown;
|
|
109
|
+
protected __set(property: string, value: unknown): void;
|
|
110
|
+
protected __delete(property: string): void;
|
|
111
|
+
protected createProxy(): MagicObjectProxy<this>;
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/helpers/ObjectsMap.d.ts
|
|
115
|
+
export type ObjectKeyExtractor<T> = (item: T) => string;
|
|
116
|
+
declare class ObjectsMap<Item extends object> {
|
|
117
|
+
static createFromArray<T extends object>(items: Iterable<T>, keyExtractor?: ObjectKeyExtractor<T>): ObjectsMap<T>;
|
|
118
|
+
static createFromArray<T extends object, S extends keyof T>(items: Iterable<T>, key: S): ObjectsMap<T>;
|
|
119
|
+
private keysToItems;
|
|
120
|
+
private itemsToKeys;
|
|
121
|
+
private getKey;
|
|
122
|
+
constructor(keyExtractor?: ObjectKeyExtractor<Item>);
|
|
123
|
+
[Symbol.iterator](): Iterator<[string, Item]>;
|
|
124
|
+
get size(): number;
|
|
125
|
+
items(): IterableIterator<Item>;
|
|
126
|
+
keys(): IterableIterator<string>;
|
|
127
|
+
entries(): IterableIterator<[string, Item]>;
|
|
128
|
+
add(item: Item): void;
|
|
129
|
+
require(key: string): Item;
|
|
130
|
+
get(key: string): Item | undefined;
|
|
131
|
+
getKeys(): string[];
|
|
132
|
+
getItems(): Item[];
|
|
133
|
+
hasKey(key: string): boolean;
|
|
134
|
+
hasItem(item: Item): boolean;
|
|
135
|
+
delete(item: Item): void;
|
|
136
|
+
filter(condition: (item: Item, key: string) => boolean): this;
|
|
137
|
+
clear(): void;
|
|
138
|
+
clone<T extends ObjectsMap<Item>>(this: T): T;
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/helpers/PromisedValue.d.ts
|
|
142
|
+
export type PromisedValueResolveListener<T> = (result: T) => unknown;
|
|
143
|
+
export type PromisedValueRejectListener = (reason?: Error) => unknown;
|
|
144
|
+
export type PromisedValueResetListener = () => unknown;
|
|
145
|
+
declare class PromisedValue<T = unknown> implements Promise<T> {
|
|
146
|
+
static from<T>(promise: Promise<T>): PromisedValue<T>;
|
|
147
|
+
private _value?;
|
|
148
|
+
private promise;
|
|
149
|
+
private _resolve;
|
|
150
|
+
private _reject;
|
|
151
|
+
private resolveListeners;
|
|
152
|
+
private rejectListeners;
|
|
153
|
+
private resetListeners;
|
|
154
|
+
constructor();
|
|
155
|
+
[Symbol.toStringTag]: string;
|
|
156
|
+
get value(): T | null;
|
|
157
|
+
isResolved(): this is {
|
|
158
|
+
value: T;
|
|
159
|
+
};
|
|
160
|
+
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: Error) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
161
|
+
catch<TResult = never>(onRejected?: ((reason: Error) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
162
|
+
finally(onFinally?: (() => void) | null): Promise<T>;
|
|
163
|
+
resolve(value: T): void;
|
|
164
|
+
reject(reason?: Error): void;
|
|
165
|
+
onResolve(listener: PromisedValueResolveListener<T>): () => void;
|
|
166
|
+
onReject(listener: PromisedValueRejectListener): () => void;
|
|
167
|
+
onReset(listener: PromisedValueResetListener): () => void;
|
|
168
|
+
reset(): void;
|
|
169
|
+
private setPromiseValues;
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/helpers/Semaphore.d.ts
|
|
173
|
+
declare class Semaphore {
|
|
174
|
+
private count;
|
|
175
|
+
private listeners;
|
|
176
|
+
constructor(count?: number);
|
|
177
|
+
acquire(): Promise<void>;
|
|
178
|
+
release(): void;
|
|
179
|
+
isAvailable(): boolean;
|
|
180
|
+
run<T>(operation: () => Promise<T>): Promise<T>;
|
|
181
|
+
private waitAvailable;
|
|
182
|
+
private notifyAvailable;
|
|
183
|
+
}
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/helpers/Storage.d.ts
|
|
186
|
+
export declare class StorageSingleton {
|
|
187
|
+
private static _instance;
|
|
188
|
+
static get instance(): StorageSingleton;
|
|
189
|
+
private constructor();
|
|
190
|
+
set<T = unknown>(key: string, value: T): void;
|
|
191
|
+
get<T>(key: string): T | null;
|
|
192
|
+
get<T>(key: string, defaultValue: T): T;
|
|
193
|
+
require<T>(key: string): T;
|
|
194
|
+
has(key: string): boolean;
|
|
195
|
+
remove(key: string): void;
|
|
196
|
+
pull<T>(key: string): T | null;
|
|
197
|
+
pull<T>(key: string, defaultValue: T): T;
|
|
198
|
+
}
|
|
199
|
+
declare const _default: StorageSingleton;
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region src/types/objects.d.ts
|
|
202
|
+
export type _Decrement<N extends number> = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10][N];
|
|
203
|
+
export type DeepRequired<T> = T extends object ? { [K in keyof T]-?: NonNullable<T[K]> extends Function ? NonNullable<T[K]> : NonNullable<T[K]> extends object ? DeepRequired<NonNullable<T[K]>> : NonNullable<T[K]>; } : T;
|
|
204
|
+
export type DeepKeyOf<T, TDepth extends number = 5, TRequired extends DeepRequired<T> = DeepRequired<T>> = NonNullable<TRequired extends object ? { [K in keyof TRequired]: TRequired[K] extends Function ? never : TRequired[K] extends Array<infer TItem> ? `${Exclude<K, symbol>}` | `${Exclude<K, symbol>}.${number}` | (Equals<0, TDepth> extends true ? never : `${Exclude<K, symbol>}.${number}.${DeepKeyOf<TItem, _Decrement<TDepth>, DeepRequired<TItem>>}`) : TRequired[K] extends object ? { [KK in keyof TRequired[K]]: TRequired[K][KK] extends Function ? never : TRequired[K][KK] extends Array<unknown> ? `${Exclude<K, symbol>}.${Exclude<KK, symbol>}` : TRequired[K][KK] extends object ? { [KKK in keyof TRequired[K][KK]]: TRequired[K][KK][KKK] extends Function ? never : `${Exclude<K, symbol>}.${Exclude<KK, symbol>}.${Exclude<KKK, symbol>}`; }[keyof TRequired[K][KK]] | `${Exclude<K, symbol>}.${Exclude<KK, symbol>}` : `${Exclude<K, symbol>}.${Exclude<KK, symbol>}`; }[keyof TRequired[K]] | `${Exclude<K, symbol>}` : `${Exclude<K, symbol>}`; }[keyof TRequired] : never>;
|
|
205
|
+
export type DeepValue<T extends object, K> = K extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? T[Key] extends object ? DeepValue<T[Key], Rest> : T[Key] : never : K extends keyof T ? T[K] : never;
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/helpers/array_helpers.d.ts
|
|
208
|
+
export type ArrayFrom<T> = T extends Iterable<infer TItem> ? TItem[] : T[];
|
|
209
|
+
export type ArraySortDirection = 'asc' | 'desc';
|
|
210
|
+
export type ArraySortFieldDirection<T> = readonly [DeepKeyOf<T>, ArraySortDirection];
|
|
211
|
+
export type ArraySortCompare<T> = (a: T, b: T) => number;
|
|
212
|
+
export declare function arrayClear(items: unknown[]): void;
|
|
213
|
+
export declare function arrayDiff<T>(original: T[], updated: T[], compareValues?: (a: T, b: T) => boolean): {
|
|
214
|
+
added: T[];
|
|
215
|
+
removed: T[];
|
|
216
|
+
};
|
|
217
|
+
export declare function arrayChunk<T>(items: T[], chunkSize: number): T[][];
|
|
218
|
+
export declare function arrayEquals<T>(original: T[], updated: T[]): boolean;
|
|
219
|
+
export declare function arrayFilter<T>(items: (T | Falsy)[]): T[];
|
|
220
|
+
export declare function arrayFilter<T>(items: T[], filter: (item: T) => boolean): T[];
|
|
221
|
+
export declare function arrayFirst<T>(items: T[], filter: (item: T) => boolean): T | null;
|
|
222
|
+
export declare function arrayFlatMap<T, R>(items: T[], map: (item: T, index: number) => R[]): R[];
|
|
223
|
+
export declare function arrayWithItemAt<T>(items: T[], item: T, index: number): T[];
|
|
224
|
+
export declare function arrayGroupBy<TItem, TKey extends string>(items: TItem[], groupBy: (item: TItem) => TKey): Partial<Record<TKey, TItem[]>>;
|
|
225
|
+
export declare function arrayGroupBy<TItem, TKey extends keyof TItem>(items: TItem[], groupBy: TKey): Record<string, TItem[]>;
|
|
226
|
+
export declare function arrayIsEmpty(items: unknown[]): boolean;
|
|
227
|
+
export declare function arrayProject<T, S extends keyof T>(items: T[], property: S): T[S][];
|
|
228
|
+
export declare function arrayPull<T>(items: T[], index: number): T | undefined;
|
|
229
|
+
export declare function arrayRandomItem<T>(items: T[]): T | null;
|
|
230
|
+
export declare function arrayRandomItems<T>(items: T[], count: number): T[];
|
|
231
|
+
export declare function arrayRemove<T>(items: T[], item: T): boolean;
|
|
232
|
+
export declare function arrayRemoveIndex<T>(items: T[], index: number | string): boolean;
|
|
233
|
+
export declare function arrayReplace<T>(items: T[], original: T, replacement: T): boolean;
|
|
234
|
+
export declare function arrayReversed<T>(items: T[]): T[];
|
|
235
|
+
export declare function arraySorted<T>(items: T[]): T[];
|
|
236
|
+
export declare function arraySorted<T>(items: T[], direction: ArraySortDirection): T[];
|
|
237
|
+
export declare function arraySorted<T>(items: T[], compareValues: ArraySortCompare<T>): T[];
|
|
238
|
+
export declare function arraySorted<T>(items: T[], field: DeepKeyOf<T>, direction?: ArraySortDirection): T[];
|
|
239
|
+
export declare function arraySorted<T>(items: T[], fields: DeepKeyOf<T>[], direction?: ArraySortDirection): T[];
|
|
240
|
+
export declare function arraySorted<T>(items: T[], fields: ArraySortFieldDirection<T>[]): T[];
|
|
241
|
+
export declare function arraySwap(items: unknown[], firstIndex: number, secondIndex: number): void;
|
|
242
|
+
export declare function arrayUnique<T>(items: T[], extractKey?: (item: T) => string): T[];
|
|
243
|
+
export declare function arrayFind<T, K extends keyof T>(items: T[], filter: string, value?: T[K]): T | undefined;
|
|
244
|
+
export declare function arrayWhere<T, K extends keyof T>(items: T[], filter: string, value?: T[K]): T[];
|
|
245
|
+
export declare function arrayWithout<T>(items: T[], exclude: T | T[]): T[];
|
|
246
|
+
export declare function arrayWithoutIndex<T>(items: T[], index: number): T[];
|
|
247
|
+
export declare function arrayWithoutIndexes<T>(items: T[], indexes: number[]): T[];
|
|
248
|
+
export declare function arrayZip<T>(...arrays: T[][]): T[][];
|
|
249
|
+
export declare function arrayFrom<TValue, TOptions extends {
|
|
250
|
+
ignoreEmptyValues?: boolean;
|
|
251
|
+
}>(value: TValue, options?: TOptions): TOptions extends {
|
|
252
|
+
ignoreEmptyValues: true;
|
|
253
|
+
} ? ArrayFrom<NonNullable<TValue>> : ArrayFrom<TValue>;
|
|
254
|
+
export declare function hasItems<T>(array: T[]): array is [T, ...T[]];
|
|
255
|
+
export declare function range(length: number): number[];
|
|
256
|
+
export declare function reduceBy<TItem, TKey extends keyof TItem, TProjection>(items: TItem[], key: TKey, project: (item: TItem) => TProjection): Record<string, TProjection>;
|
|
257
|
+
export declare function reduceBy<TItem, TKey extends keyof TItem>(items: TItem[], key: TKey): Record<string, TItem>;
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/helpers/boolean_helpers.d.ts
|
|
260
|
+
export declare function parseBoolean(value: unknown): boolean;
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/types/arrays.d.ts
|
|
263
|
+
export type CollapseTupleUnion<Tuple extends unknown[]> = _CollapseTupleUnionRecursion<Tuple, []>;
|
|
264
|
+
export type _CollapseTupleUnionRecursion<Tuple extends unknown[], Rest extends unknown[]> = Rest['length'] extends Tuple['length'] ? Rest : _CollapseTupleUnionRecursion<Tuple, [Tuple[Rest['length']], ...Rest]>;
|
|
265
|
+
export type RequiredTuple<Item, Length extends number> = Length extends Length ? number extends Length ? Item[] : _RequiredTupleRecursion<Item, Length, []> : never;
|
|
266
|
+
export type _RequiredTupleRecursion<Item, Length extends number, Rest extends unknown[]> = Rest['length'] extends Length ? Rest : _RequiredTupleRecursion<Item, Length, [Item, ...Rest]>;
|
|
267
|
+
export type _TupleRecursion<Tuple extends unknown[], Optional extends number, Rest extends unknown[]> = Tuple['length'] extends Rest['length'] ? Rest : Optional extends Rest['length'] ? _TupleRecursion<Tuple, Optional, [Tuple[Rest['length']] | undefined, ...Rest]> : _TupleRecursion<Tuple, Optional, [Tuple[Rest['length']], ...Rest]>;
|
|
268
|
+
export type ArrayDeepItem<Array> = Array extends (infer TItem)[] ? ArrayDeepItem<TItem> : Array;
|
|
269
|
+
export type ArrayIncludes<Array extends unknown[], Item> = Item extends Array[number] ? true : false;
|
|
270
|
+
export type ArrayItem<Array> = Array extends (infer Item)[] ? Item : never;
|
|
271
|
+
export type Tuple<Item, Length extends number, Optional extends number = number> = CollapseTupleUnion<_TupleRecursion<RequiredTuple<Item, Length>, Optional, []>>;
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/helpers/caching_helpers.d.ts
|
|
274
|
+
export declare function asyncMemo<T>(key: string, operation: () => Promise<T>): Promise<T>;
|
|
275
|
+
export declare function memo<T>(key: string, operation: () => T): T;
|
|
276
|
+
export declare function once<P extends ClosureArgs, R>(operation: Closure<P, R>): Closure<P, R>;
|
|
277
|
+
export declare function weakMemo<T>(name: string, key: object, operation: () => T): T;
|
|
278
|
+
export declare function getAsyncMemo<T>(key: string): Promise<T | null>;
|
|
279
|
+
export declare function getMemo<T>(key: string): T | null;
|
|
280
|
+
export declare function getWeakMemo<T>(name: string, key: object): T | null;
|
|
281
|
+
export declare function resetAsyncMemo(key?: string): void;
|
|
282
|
+
export declare function resetMemo(key?: string): void;
|
|
283
|
+
export declare function resetWeakMemo(name: string, key: object): void;
|
|
284
|
+
export declare function setAsyncMemo(key: string, value: unknown): void;
|
|
285
|
+
export declare function setMemo(key: string, value: unknown): void;
|
|
286
|
+
export declare function setWeakMemo(name: string, key: object, value: unknown): void;
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region src/helpers/chaos_helpers.d.ts
|
|
289
|
+
export declare function randomInt(): number;
|
|
290
|
+
export declare function randomInt(max: number): number;
|
|
291
|
+
export declare function randomInt(min: number, max: number): number;
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region src/helpers/date_helpers.d.ts
|
|
294
|
+
export declare function parseDate(value?: unknown): Date | null;
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/helpers/deprecated.d.ts
|
|
297
|
+
/**
|
|
298
|
+
* @deprecated use NonNullable<T> instead.
|
|
299
|
+
*/
|
|
300
|
+
export type ValueWithoutEmpty<T> = T extends null | undefined ? never : T;
|
|
301
|
+
/**
|
|
302
|
+
* @deprecated use ReplaceValues<T, null | undefined> instead.
|
|
303
|
+
*/
|
|
304
|
+
export type ReplaceEmpty<T> = { [K in keyof T]: ValueWithoutEmpty<T[K]>; };
|
|
305
|
+
/**
|
|
306
|
+
* @deprecated use GetRequiredKeysWithout<T, null | undefined> instead.
|
|
307
|
+
*/
|
|
308
|
+
export type GetRequiredKeysWithoutEmpty<T, U extends Record<keyof T, unknown> = ReplaceEmpty<T>> = { [K in keyof T]: Record<string, never> extends Pick<T, K> ? never : U[K] extends never ? never : Equals<T[K], U[K]> extends true ? K : never; }[keyof T];
|
|
309
|
+
/**
|
|
310
|
+
* @deprecated use GetOptionalKeysWithout<T, null | undefined> instead.
|
|
311
|
+
*/
|
|
312
|
+
export type GetOptionalKeysWithoutEmpty<T, U extends Record<keyof T, unknown> = ReplaceEmpty<T>> = { [K in keyof T]: Record<string, never> extends Pick<T, K> ? K : U[K] extends never ? never : Equals<T[K], U[K]> extends true ? never : K; }[keyof T];
|
|
313
|
+
/**
|
|
314
|
+
* @deprecated use ObjectWithout<T, null | undefined> instead.
|
|
315
|
+
*/
|
|
316
|
+
export type ObjectWithoutEmpty<T> = { [K in GetRequiredKeysWithoutEmpty<T>]: ValueWithoutEmpty<T[K]>; } & { [K in GetOptionalKeysWithoutEmpty<T>]?: ValueWithoutEmpty<T[K]>; };
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/helpers/env.d.ts
|
|
319
|
+
export declare function forceEnv(env: string): void;
|
|
320
|
+
export declare function getEnv(): string | null;
|
|
321
|
+
export declare function isDevelopment(): boolean;
|
|
322
|
+
export declare function isTesting(type?: 'unit' | 'e2e'): boolean;
|
|
323
|
+
export declare function isProduction(): boolean;
|
|
324
|
+
export declare function applyStrictChecks(): boolean;
|
|
325
|
+
//#endregion
|
|
326
|
+
//#region src/helpers/value_helpers.d.ts
|
|
327
|
+
export type EvaluatesTo<T> = T | (() => T);
|
|
328
|
+
export declare function evaluate<T>(value: EvaluatesTo<T>): T;
|
|
329
|
+
export declare function isTruthy<T>(value: T): value is Truthy<T>;
|
|
330
|
+
//#endregion
|
|
331
|
+
//#region src/helpers/error_helpers.d.ts
|
|
332
|
+
export declare function assert(assertion: EvaluatesTo<boolean>, message?: string): void;
|
|
333
|
+
export declare function assert<E extends Error = Error>(assertion: EvaluatesTo<boolean>, errorClass?: Constructor<E>, ...params: ConstructorParameters<Constructor<E>>): void;
|
|
334
|
+
export declare function catchError(callback: () => unknown): Error | null;
|
|
335
|
+
export declare function fail<T = any>(message?: string): T;
|
|
336
|
+
export declare function fail<T = any, E extends Constructor<Error> = Constructor<Error>>(errorClass?: E, ...params: ConstructorParameters<E>): T;
|
|
337
|
+
export declare function fail<T = any, E extends Constructor<JSError> = Constructor<JSError>>(errorClass?: E, ...params: ConstructorParameters<E>): T;
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region src/helpers/escape_helpers.d.ts
|
|
340
|
+
export declare function escapeHtmlEntities(text: string): string;
|
|
341
|
+
export declare function escapeRegexText(text: string): string;
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/helpers/file_helpers.d.ts
|
|
344
|
+
export declare function downloadFile(filename: string, content: string, mediaType: string): void;
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region src/helpers/format_helpers.d.ts
|
|
347
|
+
export interface FormatCodeBlockOptions {
|
|
348
|
+
indent?: number;
|
|
349
|
+
}
|
|
350
|
+
export declare function formatCodeBlock(code: string, options?: FormatCodeBlockOptions): string;
|
|
351
|
+
//#endregion
|
|
352
|
+
//#region src/helpers/hash_helpers.d.ts
|
|
353
|
+
export declare function md5(message: string): string;
|
|
354
|
+
//#endregion
|
|
355
|
+
//#region src/helpers/identity_helpers.d.ts
|
|
356
|
+
export declare function shortId(length?: number): string;
|
|
357
|
+
export declare function uuid(): string;
|
|
358
|
+
//#endregion
|
|
359
|
+
//#region src/helpers/location_helpers.d.ts
|
|
360
|
+
export declare function getLocationQueryParameter(parameter: string): string | undefined;
|
|
361
|
+
export declare function getLocationQueryParameters<T extends string = string>(): Partial<{ [key in T]: string; }>;
|
|
362
|
+
export declare function hasLocationQueryParameter(parameter: string): boolean;
|
|
363
|
+
export declare function updateLocationQueryParameters(parameters: Record<string, string | undefined>): Promise<void>;
|
|
364
|
+
export declare function deleteLocationQueryParameters(parameters: string[]): Promise<void>;
|
|
365
|
+
//#endregion
|
|
366
|
+
//#region src/helpers/logical_helpers.d.ts
|
|
367
|
+
export declare function compare<T>(a: T, b: T): 1 | -1 | 0;
|
|
368
|
+
//#endregion
|
|
369
|
+
//#region src/helpers/math_helpers.d.ts
|
|
370
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
371
|
+
export declare function round(value: number, places?: number): number;
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/helpers/mixin_helpers.d.ts
|
|
374
|
+
export declare function applyMixins<Base extends Constructor>(baseClass: Base, mixinClasses?: Constructor[]): void;
|
|
375
|
+
export type Cr<T> = Constructor<T>;
|
|
376
|
+
export declare function mixed<A>(mixins: [Cr<A>]): Cr<A>;
|
|
377
|
+
export declare function mixed<A, B>(mixins: [Cr<A>, Cr<B>]): Cr<A & B>;
|
|
378
|
+
export declare function mixed<A, B, C>(mixins: [Cr<A>, Cr<B>, Cr<C>]): Cr<A & B & C>;
|
|
379
|
+
export declare function mixed<A, B, C, D>(mixins: [Cr<A>, Cr<B>, Cr<C>, Cr<D>]): Cr<A & B & C & D>;
|
|
380
|
+
export declare function mixed<Base, A>(baseClass: Base, mixins: [Cr<A>]): Base & Cr<A>;
|
|
381
|
+
export declare function mixed<Base, A, B>(baseClass: Base, mixins: [Cr<A>, Cr<B>]): Base & Cr<A & B>;
|
|
382
|
+
export declare function mixed<Base, A, B, C>(baseClass: Base, mixins: [Cr<A>, Cr<B>, Cr<C>]): Base & Cr<A & B & C>;
|
|
383
|
+
export declare function mixed<Base, A, B, C, D>(baseClass: Base, mixins: [Cr<A>, Cr<B>, Cr<C>, Cr<D>]): Base & Cr<A & B & C & D>;
|
|
384
|
+
export declare function mixed<Base, A, B, C, D, E>(baseClass: Base, mixins: [Cr<A>, Cr<B>, Cr<C>, Cr<D>, Cr<E>]): Base & Cr<A & B & C & D & E>;
|
|
385
|
+
export declare function mixed<Base, A, B, C, D, E, F>(baseClass: Base, mixins: [Cr<A>, Cr<B>, Cr<C>, Cr<D>, Cr<E>, Cr<F>]): Base & Cr<A & B & C & D & E & F>;
|
|
386
|
+
export declare function mixed<Base, A, B, C, D, E, F, G>(baseClass: Base, mixins: [Cr<A>, Cr<B>, Cr<C>, Cr<D>, Cr<E>, Cr<F>, Cr<G>]): Base & Cr<A & B & C & D & E & F & G>;
|
|
387
|
+
export declare function mixedWithoutTypes(mixins: Constructor[]): Object;
|
|
388
|
+
export declare function mixedWithoutTypes<Base>(baseClass: Base, mixins: Constructor[]): Base;
|
|
389
|
+
export declare function usesMixin(target: any, mixin: Constructor): boolean;
|
|
390
|
+
//#endregion
|
|
391
|
+
//#region src/helpers/network_helpers.d.ts
|
|
392
|
+
export declare function isSuccessfulResponse(response: Response): boolean;
|
|
393
|
+
//#endregion
|
|
394
|
+
//#region src/helpers/object_helpers.d.ts
|
|
395
|
+
export type Obj = Record<string, unknown>;
|
|
396
|
+
export type GetObjectKeys<T> = T extends Record<infer Key, any> ? Key : keyof T;
|
|
397
|
+
export type GetObjectValues<T> = T extends Record<any, infer Value> ? Value : never;
|
|
398
|
+
export type ValueWithout<TValue, TExclude> = TValue extends TExclude ? never : TValue;
|
|
399
|
+
export type ReplaceValues<TObj, TExclude> = { [K in keyof TObj]: ValueWithout<TObj[K], TExclude>; };
|
|
400
|
+
export type GetRequiredKeysWithout<TObj, TExclude, U extends Record<keyof TObj, unknown> = ReplaceValues<TObj, TExclude>> = { [K in keyof TObj]: Record<string, never> extends Pick<TObj, K> ? never : U[K] extends never ? never : Equals<TObj[K], U[K]> extends true ? K : never; }[keyof TObj];
|
|
401
|
+
export type GetOptionalKeysWithout<TObj, TExclude, U extends Record<keyof TObj, unknown> = ReplaceValues<TObj, TExclude>> = { [K in keyof TObj]: Record<string, never> extends Pick<TObj, K> ? K : U[K] extends never ? never : Equals<TObj[K], U[K]> extends true ? never : K; }[keyof TObj];
|
|
402
|
+
export type ObjectWithout<TObj, TExclude> = Pretty<{ [K in GetRequiredKeysWithout<TObj, TExclude>]: ValueWithout<TObj[K], TExclude>; } & { [K in GetOptionalKeysWithout<TObj, TExclude>]?: ValueWithout<TObj[K], TExclude>; }>;
|
|
403
|
+
export declare function deepEquals(a: unknown, b: unknown): boolean;
|
|
404
|
+
export declare function deepAssign<T extends object>(target: T, ...sources: T[]): T;
|
|
405
|
+
export declare function deepGet<T extends object, K extends DeepKeyOf<T>>(object: T, key: K): DeepValue<T, K>;
|
|
406
|
+
export declare function deepSet<T extends object, K extends DeepKeyOf<T>>(object: T, key: K, value: DeepValue<T, K>): void;
|
|
407
|
+
export declare function getClassMethods(target: object): string[];
|
|
408
|
+
export declare function invert(map: Record<string, string>): Record<string, string>;
|
|
409
|
+
export declare const isArray: (arg: any) => arg is any[];
|
|
410
|
+
export declare function isConstructor(value: object): value is Constructor;
|
|
411
|
+
export declare function isEmpty(value: unknown): boolean;
|
|
412
|
+
export declare function isInstanceOf<T>(value: unknown, objectClass: Constructor<T>): value is T;
|
|
413
|
+
export declare function isIterable(value: unknown): value is Iterable<unknown>;
|
|
414
|
+
export declare function isObject(value: unknown): value is Obj;
|
|
415
|
+
export declare function isPlainObject(value: unknown): value is object;
|
|
416
|
+
export declare function isString(value: unknown): value is string | String;
|
|
417
|
+
export declare function isNullable(value: unknown): value is undefined | null;
|
|
418
|
+
export declare function isPromiseLike(value: unknown): value is PromiseLike<unknown>;
|
|
419
|
+
export declare function isSubclassOf(value: Constructor, baseClass: Constructor): boolean;
|
|
420
|
+
export declare function monkeyPatch<T, K extends GetObjectMethods<T>>(object: T, method: K, callback: VoidClosure<T[K]>): void;
|
|
421
|
+
export declare function objectDeepClone<T extends Obj>(object: T): T;
|
|
422
|
+
export declare const objectEntries: <T extends Parameters<typeof Object.entries>[0]>(obj: T) => [GetObjectKeys<T>, GetObjectValues<T>][];
|
|
423
|
+
export declare const objectFromEntries: <K extends string | number | symbol, V>(value: Iterable<readonly [K, V]>) => Record<K, V>;
|
|
424
|
+
export declare const objectValues: <T extends {
|
|
425
|
+
[k: string]: any;
|
|
426
|
+
} | ArrayLike<any>>(object: T) => GetObjectValues<T>[];
|
|
427
|
+
export declare const objectKeys: <T extends {
|
|
428
|
+
[k: string]: any;
|
|
429
|
+
} | ArrayLike<any>>(object: T) => GetObjectKeys<T>[];
|
|
430
|
+
export declare function objectHasOwnProperty(object: Obj, property: string): boolean;
|
|
431
|
+
export declare function objectMap<T>(items: T[], property: KeyOf<T, number | string>): Record<string, T>;
|
|
432
|
+
export declare function objectOnly<T extends object, K extends keyof T>(obj: T, keys: K | K[]): Pick<T, K>;
|
|
433
|
+
export declare function objectPropertyIsObject<T extends string>(object: Obj, property: T): object is { [t in T]: Obj; };
|
|
434
|
+
export declare function objectPull<T extends Obj, K extends keyof T>(obj: T, key: K): T[K];
|
|
435
|
+
export declare function objectWithout<TObj extends Obj, TKey extends keyof TObj>(obj: TObj, key: TKey): Omit<TObj, TKey>;
|
|
436
|
+
export declare function objectWithout<TObj extends object, TKey extends keyof TObj>(obj: TObj, key: TKey): Omit<TObj, TKey>;
|
|
437
|
+
export declare function objectWithout<TObj extends Obj, TKey extends keyof TObj>(obj: TObj, keys: TKey[]): Omit<TObj, TKey>;
|
|
438
|
+
export declare function objectWithout<TObj extends object, TKey extends keyof TObj>(obj: TObj, keys: TKey[]): Omit<TObj, TKey>;
|
|
439
|
+
export declare function objectWithout<TObj extends Obj, TExclude>(obj: TObj, exclude: TypeGuard<TExclude>): ObjectWithout<TObj, TExclude>;
|
|
440
|
+
export declare function objectWithout<TObj extends object, TExclude>(obj: TObj, exclude: TypeGuard<TExclude>): ObjectWithout<TObj, TExclude>;
|
|
441
|
+
export declare function objectWithoutEmpty<T extends Obj>(obj: T): ObjectWithout<T, null | undefined>;
|
|
442
|
+
export declare function objectWithoutEmpty<T extends object>(obj: T): ObjectWithout<T, null | undefined>;
|
|
443
|
+
export declare function overridePrototypeMethod<T, K extends GetObjectMethods<T>>(target: Constructor<T>, method: K, implementation: T[K]): void;
|
|
444
|
+
export declare function toString(value: unknown): string;
|
|
445
|
+
export declare function toError(value: unknown): Error;
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region src/helpers/promise_helpers.d.ts
|
|
448
|
+
export declare function asyncFirst<TValue, TResult>(values: TValue[], operation: (value: TValue) => Promise<TResult | null>): Promise<TResult | null>;
|
|
449
|
+
export declare function isPromise(p: unknown): p is Promise<unknown>;
|
|
450
|
+
export declare function silenced<Args extends ClosureArgs, Result>(operation: Closure<Args, Promise<Result>>): Closure<Args, Promise<Result | null>>;
|
|
451
|
+
export declare function silenced<Args extends ClosureArgs, Result, Default>(operation: Closure<Args, Promise<Result>>, defaultValue: Default): Closure<Args, Promise<Result | Default>>;
|
|
452
|
+
export declare function silenced<Result>(promise: Promise<Result>): Promise<Result | null>;
|
|
453
|
+
export declare function silenced<Args extends ClosureArgs, Result, Default>(operation: Closure<Args, Promise<Result>>, defaultValue: Default): Closure<Args, Promise<Result | Default>>;
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region src/helpers/replacements.d.ts
|
|
456
|
+
export type Replacements = Record<string, unknown>;
|
|
457
|
+
export declare function applyReplacements(text: string, replacements?: Replacements): string;
|
|
458
|
+
//#endregion
|
|
459
|
+
//#region src/helpers/runtime_helpers.d.ts
|
|
460
|
+
export declare function runtimeGlobal<T = any>(): T;
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/helpers/string_helpers.d.ts
|
|
463
|
+
export type Slug = Branded<string, 'slug'>;
|
|
464
|
+
export declare function stringCapitalize(text: string): string;
|
|
465
|
+
export declare function stringExcerpt(text: string, maxLength?: number, filler?: string): string;
|
|
466
|
+
export declare function stringMatch<Length extends number, Optional extends number = number>(text: string, pattern: RegExp): Tuple<ArrayItem<RegExpMatchArray>, Length, Optional> | null;
|
|
467
|
+
export declare function stringMatchAll<Length extends number, Optional extends number = number>(text: string, pattern: RegExp): IterableIterator<Tuple<ArrayItem<RegExpMatchArray>, Length, Optional>>;
|
|
468
|
+
export declare function stringReverse(text: string): string;
|
|
469
|
+
export declare function stringSplitWords(text: string): string[];
|
|
470
|
+
export declare function stringToCamelCase(text: string): string;
|
|
471
|
+
export declare function stringToSlug(text: string, separator?: string): Slug;
|
|
472
|
+
export declare function stringToStudlyCase(text: string): string;
|
|
473
|
+
export declare function stringToTitleCase(text: string): string;
|
|
474
|
+
export declare function stringTrimmed(text: string): string;
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region src/helpers/time_constants.d.ts
|
|
477
|
+
export declare const MINUTE_MILLISECONDS: number;
|
|
478
|
+
export declare const HOUR_MILLISECONDS: number;
|
|
479
|
+
export declare const DAY_MILLISECONDS: number;
|
|
480
|
+
export declare const WEEK_MILLISECONDS: number;
|
|
481
|
+
export declare const MONTH_MILLISECONDS: number;
|
|
482
|
+
export declare const YEAR_MILLISECONDS: number;
|
|
483
|
+
export declare const MINUTE_SECONDS = 60;
|
|
484
|
+
export declare const HOUR_SECONDS: number;
|
|
485
|
+
export declare const DAY_SECONDS: number;
|
|
486
|
+
export declare const WEEK_SECONDS: number;
|
|
487
|
+
export declare const MONTH_SECONDS: number;
|
|
488
|
+
export declare const YEAR_SECONDS: number;
|
|
489
|
+
//#endregion
|
|
490
|
+
//#region src/helpers/time_helpers.d.ts
|
|
491
|
+
export interface DebouncedFunction<Args extends ClosureArgs> {
|
|
492
|
+
(...args: Args): void;
|
|
493
|
+
cancel(): void;
|
|
494
|
+
}
|
|
495
|
+
export interface AfterOptions {
|
|
496
|
+
ms?: number;
|
|
497
|
+
milliseconds?: number;
|
|
498
|
+
s?: number;
|
|
499
|
+
seconds?: number;
|
|
500
|
+
}
|
|
501
|
+
export declare function after(ms: number): Promise<void>;
|
|
502
|
+
export declare function after(options?: AfterOptions): Promise<void>;
|
|
503
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
504
|
+
export declare function sleep(options?: AfterOptions): Promise<void>;
|
|
505
|
+
export declare function afterAnimationFrame(): Promise<void>;
|
|
506
|
+
export declare function debounce<Args extends ClosureArgs>(callback: (...args: Args) => unknown, delay: number): DebouncedFunction<Args>;
|
|
507
|
+
export declare function forever(): Promise<void>;
|
|
508
|
+
export declare function isValidDateString(value: string): boolean;
|
|
509
|
+
export declare function seconds(time?: Date | number, round?: boolean): number;
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region src/helpers/url_helpers.d.ts
|
|
512
|
+
export interface UrlParts {
|
|
513
|
+
protocol?: string;
|
|
514
|
+
domain?: string;
|
|
515
|
+
port?: string;
|
|
516
|
+
path?: string;
|
|
517
|
+
query?: string;
|
|
518
|
+
fragment?: string;
|
|
519
|
+
}
|
|
520
|
+
export declare function requireUrlParentDirectory(url: string): string;
|
|
521
|
+
export declare function requireUrlDirectoryName(url: string): string;
|
|
522
|
+
export declare function requireUrlParse(url: string): UrlParts;
|
|
523
|
+
export declare function urlResolve(...parts: string[]): string;
|
|
524
|
+
export declare function urlResolveDirectory(...parts: string[]): string;
|
|
525
|
+
export declare function urlRoot(url: string): string;
|
|
526
|
+
export declare function urlParentDirectory(url: string): string | null;
|
|
527
|
+
export declare function urlDirectoryName(url: string): string | null;
|
|
528
|
+
export declare function urlFileName(url: string): string;
|
|
529
|
+
export declare function urlParse(url: string): UrlParts | null;
|
|
530
|
+
export declare function urlClean(url: string, includedParts: { [part in keyof UrlParts]?: boolean; }): string;
|
|
531
|
+
export declare function urlRoute(url: string): string;
|
|
532
|
+
export declare function validUrl(url: string): string | null;
|
|
533
|
+
//#endregion
|
|
534
|
+
//#region src/fluent/FluentObject.d.ts
|
|
535
|
+
type Helper<Primitive = unknown> = (value: Primitive, ...args: any[]) => unknown;
|
|
536
|
+
type HelperParams<TPrimitive, THelper> = THelper extends ((value: TPrimitive, ...args: infer P) => unknown) ? P : never;
|
|
537
|
+
type FluentPrimitiveMethods<FluentClass, Primitive extends Record<PrimitiveKey, unknown>, PrimitiveKey extends string | number | symbol, Helpers extends Record<string, Helper<Primitive>>> = { [K in PrimitiveKey]: Primitive extends Record<K, (...args: infer P) => Primitive> ? (...args: P) => FluentInstance<FluentClass, Primitive, PrimitiveKey, Helpers> : Primitive[K]; };
|
|
538
|
+
type FluentHelperMethods<FluentClass, Primitive extends Record<PrimitiveKey, unknown>, PrimitiveKey extends string | number | symbol, Helpers extends Record<string, Helper<Primitive>>> = { [K in keyof Helpers]: Helpers extends Record<K, (value: Primitive, ...args: any[]) => Primitive> ? (...args: HelperParams<Primitive, Helpers[K]>) => FluentInstance<FluentClass, Primitive, PrimitiveKey, Helpers> : (...args: HelperParams<Primitive, Helpers[K]>) => ReturnType<Helpers[K]>; };
|
|
539
|
+
type FluentInstance<FluentClass, Primitive extends Record<PrimitiveKey, unknown>, PrimitiveKey extends string | number | symbol, Helpers extends Record<string, Helper<Primitive>>> = FluentClass & FluentHelperMethods<FluentClass, Primitive, PrimitiveKey, Helpers> & FluentPrimitiveMethods<FluentClass, Primitive, PrimitiveKey, Helpers>;
|
|
540
|
+
declare abstract class FluentObjectDefinition<Primitive> {
|
|
541
|
+
protected value: Primitive;
|
|
542
|
+
static isPrimitive(value: unknown): boolean;
|
|
543
|
+
constructor(value: Primitive);
|
|
544
|
+
protected abstract isPrimitive(value: unknown): value is Primitive;
|
|
545
|
+
protected create(value: Primitive): this;
|
|
546
|
+
protected chain(value: unknown): unknown;
|
|
547
|
+
}
|
|
548
|
+
//#endregion
|
|
549
|
+
//#region src/fluent/FluentArray.d.ts
|
|
550
|
+
type FluentArrayHelpers<T> = {
|
|
551
|
+
clear(items: T[]): void;
|
|
552
|
+
diff(items: T[], updated: T[]): {
|
|
553
|
+
added: T[];
|
|
554
|
+
removed: T[];
|
|
555
|
+
};
|
|
556
|
+
first(items: T[], filter: (item: T) => boolean): T | null;
|
|
557
|
+
filter(items: T[], filter?: (item: T) => boolean): T[] | Exclude<T, Falsy>[];
|
|
558
|
+
flatMap<TMapped>(items: T[], map?: (item: T, index: number) => TMapped[]): TMapped[];
|
|
559
|
+
groupBy<TKey extends string>(items: T[], groupBy: (item: T) => TKey): Partial<Record<TKey, T[]>>;
|
|
560
|
+
groupBy<TKey extends keyof T>(items: T[], groupBy: TKey): Record<string, T[]>;
|
|
561
|
+
isEmpty(items: T[]): boolean;
|
|
562
|
+
project(items: T[], property: string): unknown[];
|
|
563
|
+
randomItem(items: T[]): T | null;
|
|
564
|
+
randomItems(items: T[], count: number): T[];
|
|
565
|
+
remove(items: T[], item: T): boolean;
|
|
566
|
+
removeIndex(items: T[], index: number | string): boolean;
|
|
567
|
+
replace(items: T[], original: T, replacement: T): boolean;
|
|
568
|
+
sorted(items: T[]): T[];
|
|
569
|
+
unique(items: T[], extractKey?: (item: T) => string): T[];
|
|
570
|
+
where(items: T[], filter: string, value?: unknown): T[];
|
|
571
|
+
without(items: T[], exclude: T[]): T[];
|
|
572
|
+
withoutIndexes(items: T[], indexes: number[]): T[];
|
|
573
|
+
};
|
|
574
|
+
type FluentArrayInstance<FluentClass, Item> = FluentInstance<FluentClass, Item[], keyof Item[], FluentArrayHelpers<Item>>;
|
|
575
|
+
type FluentArray<T> = FluentArrayInstance<FluentArrayDefinition<T>, T>;
|
|
576
|
+
declare class FluentArrayDefinition<Item> extends FluentObjectDefinition<Item[]> {
|
|
577
|
+
static create<T>(value?: T[]): FluentArrayInstance<FluentArrayDefinition<T>, T>;
|
|
578
|
+
[Symbol.iterator](): Iterator<Item>;
|
|
579
|
+
flatMap: <T>(callback: (item: Item, index: number) => T[]) => FluentArrayInstance<FluentArrayDefinition<T>, T>;
|
|
580
|
+
map: <T>(callback: (item: Item, index: number) => T) => FluentArrayInstance<FluentArrayDefinition<T>, T>;
|
|
581
|
+
project: <K extends keyof Item>(key: K) => Item[K][];
|
|
582
|
+
where: <K extends keyof Item>(key: K, value?: Item[K]) => FluentArrayInstance<FluentArrayDefinition<Item>, Item>;
|
|
583
|
+
get(index: number): Item | undefined;
|
|
584
|
+
toArray(): Item[];
|
|
585
|
+
protected isPrimitive(value: unknown): value is Item[];
|
|
586
|
+
}
|
|
587
|
+
interface FluentArrayDefinition<Item> {
|
|
588
|
+
filter(): FluentArrayInstance<FluentArrayDefinition<Exclude<Item, Falsy>>, Exclude<Item, Falsy>>;
|
|
589
|
+
filter(filter: (item: Item) => boolean): FluentArrayInstance<FluentArrayDefinition<Item>, Item>;
|
|
590
|
+
}
|
|
591
|
+
//#endregion
|
|
592
|
+
//#region src/fluent/FluentString.d.ts
|
|
593
|
+
export declare const fluentStringHelpers: {
|
|
594
|
+
reverse: typeof stringReverse;
|
|
595
|
+
toCamelCase: typeof stringToCamelCase;
|
|
596
|
+
toSlug: typeof stringToSlug;
|
|
597
|
+
toStudlyCase: typeof stringToStudlyCase;
|
|
598
|
+
toTitleCase: typeof stringToTitleCase;
|
|
599
|
+
};
|
|
600
|
+
type FluentStringInstance<FluentClass> = FluentInstance<FluentClass, string, keyof string, typeof fluentStringHelpers>;
|
|
601
|
+
type FluentString = FluentStringInstance<FluentStringDefinition>;
|
|
602
|
+
declare class FluentStringDefinition extends FluentObjectDefinition<string> {
|
|
603
|
+
static create<T>(this: T, value?: string): FluentStringInstance<ClassInstance<T>>;
|
|
604
|
+
toString(): string;
|
|
605
|
+
protected isPrimitive(value: unknown): value is string;
|
|
606
|
+
}
|
|
607
|
+
//#endregion
|
|
608
|
+
//#region src/fluent/facade.d.ts
|
|
609
|
+
export type FacadeExtension = (facadeInstance: FacadeMethods) => void;
|
|
610
|
+
export interface FacadeMethods<TInstance extends object = object> {
|
|
611
|
+
newInstance(): TInstance;
|
|
612
|
+
requireInstance(): TInstance;
|
|
613
|
+
setInstance(instance: TInstance): TInstance;
|
|
614
|
+
reset(): TInstance;
|
|
615
|
+
}
|
|
616
|
+
export type Facade<TInstance extends object = object> = TInstance & FacadeMethods<TInstance>;
|
|
617
|
+
export declare function facade<TInstance extends object>(defaultClassOrFactory: (() => TInstance) | Constructor<TInstance>): Facade<TInstance>;
|
|
618
|
+
export declare function extendFacadeMethods(extension: FacadeExtension): void;
|
|
619
|
+
export declare function isFacade(value: unknown): value is Facade;
|
|
620
|
+
export declare function getFacadeInstance<T extends object>(value: Facade<T>): T;
|
|
621
|
+
export declare function getFacadeInstance<T>(value: T): T;
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/fluent/tap.d.ts
|
|
624
|
+
type Tapped<Target extends object> = { [prop in keyof Target]: Target[prop] extends ((...params: infer Params) => unknown) ? (...params: Params) => Tapped<Target> : Target[prop]; };
|
|
625
|
+
export declare function tap<Target extends object>(target: Target): Tapped<Target>;
|
|
626
|
+
export declare function tap<Target>(target: Target, callback: (target: Target) => Promise<unknown>): Promise<Target>;
|
|
627
|
+
export declare function tap<Target>(target: Target, callback: (target: Target) => unknown): Target;
|
|
628
|
+
//#endregion
|
|
629
|
+
//#region src/fluent/noop.d.ts
|
|
630
|
+
export declare function noop(): void;
|
|
631
|
+
//#endregion
|
|
632
|
+
//#region src/fluent/required.d.ts
|
|
633
|
+
export declare function required<T extends object | null | undefined>(getValue: () => T, errorMessage?: string): NonNullable<T>;
|
|
634
|
+
export declare function required<T>(value: T, errorMessage?: string): NonNullable<T>;
|
|
635
|
+
//#endregion
|
|
636
|
+
//#region src/fluent/value.d.ts
|
|
637
|
+
export declare function value<T>(evaluator: () => T): T;
|
|
638
|
+
export declare function value<T>(evaluator: T): T;
|
|
639
|
+
//#endregion
|
|
640
|
+
//#region src/fluent/when.d.ts
|
|
641
|
+
export declare function when<T extends object>(target: T, condition: () => boolean): T;
|
|
642
|
+
export declare function when<T extends object>(target: T, condition: boolean): T;
|
|
643
|
+
export declare function when<T extends object>(target: any, condition: (t: any) => t is T): T;
|
|
644
|
+
//#endregion
|
|
645
|
+
//#region src/fluent/invade.d.ts
|
|
646
|
+
export type Invaded<TObject, TMethods extends string> = { [K in TMethods]: TObject[K]; };
|
|
647
|
+
export declare function invade<T, TMethods extends string>(object: T, methods: TMethods[]): Override<T, Invaded<T, TMethods>>;
|
|
648
|
+
//#endregion
|
|
649
|
+
//#region src/fluent/index.d.ts
|
|
650
|
+
export declare function str(value?: string): FluentStringInstance<FluentStringDefinition>;
|
|
651
|
+
export declare function arr<T>(value: Iterable<T>): FluentArrayInstance<FluentArrayDefinition<T>, T>;
|
|
652
|
+
export declare function arr<T>(value: T): FluentArrayInstance<FluentArrayDefinition<T>, T>;
|
|
653
|
+
export declare function arr<T>(): FluentArrayInstance<FluentArrayDefinition<T>, T>;
|
|
654
|
+
export declare function map<T>(items: string[], getKey?: (item: string) => T): Record<string, T>;
|
|
655
|
+
export declare function map<T extends object>(items: []): ObjectsMap<T>;
|
|
656
|
+
export declare function map<T extends object>(items: Iterable<T>, getKey?: (item: T) => string): ObjectsMap<T>;
|
|
657
|
+
export declare function map<T extends object, S extends keyof T>(items: Iterable<T>, key: S): ObjectsMap<T>;
|
|
658
|
+
export declare function pull<T>(items: T[], index: number): T;
|
|
659
|
+
export declare function pull<T extends Obj, K extends keyof T>(obj: T, key: K): T[K];
|
|
660
|
+
export declare function fluent(value: string): FluentStringInstance<FluentStringDefinition>;
|
|
661
|
+
export declare function fluent<T>(value: T[]): FluentArrayInstance<FluentArrayDefinition<T>, T>;
|
|
662
|
+
//#endregion
|
|
663
|
+
export { type FluentArray, FluentArrayDefinition, type FluentArrayHelpers, type FluentArrayInstance, type FluentHelperMethods, type FluentInstance, FluentObjectDefinition, type FluentPrimitiveMethods, type FluentString, FluentStringDefinition, type FluentStringInstance, type Helper, type HelperParams, IndexedDBMap, JSError, ListenersManager, MagicObject, ObjectsMap, PromisedValue, Semaphore, _default as Storage, type Tapped };
|
|
664
|
+
//# sourceMappingURL=noeldemartin-utils.d.ts.map
|