@oscarpalmer/atoms 0.204.0 → 0.205.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.
Files changed (69) hide show
  1. package/dist/array/filter.d.mts +1 -1
  2. package/dist/array/find.d.mts +3 -3
  3. package/dist/array/first.d.mts +3 -4
  4. package/dist/array/first.mjs +1 -1
  5. package/dist/array/group-by.d.mts +3 -3
  6. package/dist/array/index.d.mts +2 -5
  7. package/dist/array/index.mjs +2 -5
  8. package/dist/array/last.d.mts +3 -4
  9. package/dist/array/last.mjs +1 -1
  10. package/dist/array/move.d.mts +4 -4
  11. package/dist/array/push.d.mts +2 -1
  12. package/dist/array/push.mjs +1 -1
  13. package/dist/array/select.d.mts +95 -84
  14. package/dist/array/select.mjs +6 -6
  15. package/dist/array/sort.d.mts +6 -6
  16. package/dist/array/swap.d.mts +3 -3
  17. package/dist/array/swap.mjs +1 -1
  18. package/dist/array/to-map.d.mts +3 -3
  19. package/dist/array/to-record.d.mts +3 -3
  20. package/dist/beacon.mjs +2 -2
  21. package/dist/color/constants.d.mts +14 -41
  22. package/dist/color/instance.d.mts +0 -1
  23. package/dist/color/misc/state.d.mts +2 -29
  24. package/dist/color/models.d.mts +18 -4
  25. package/dist/function/limit.d.mts +4 -4
  26. package/dist/function/once.d.mts +6 -8
  27. package/dist/function/retry.d.mts +2 -2
  28. package/dist/index.d.mts +1011 -1020
  29. package/dist/index.mjs +113 -102
  30. package/dist/internal/array/compact.d.mts +1 -1
  31. package/dist/internal/array/find.d.mts +4 -4
  32. package/dist/internal/array/index-of.d.mts +3 -3
  33. package/dist/internal/array/insert.d.mts +1 -1
  34. package/dist/internal/array/match.d.mts +1 -1
  35. package/dist/internal/array/sets.d.mts +1 -1
  36. package/dist/internal/function/assert.d.mts +7 -7
  37. package/dist/internal/function/limit.d.mts +1 -1
  38. package/dist/internal/function/work.d.mts +4 -4
  39. package/dist/internal/herald.d.mts +1 -1
  40. package/dist/internal/math/aggregate.d.mts +2 -2
  41. package/dist/internal/result/misc.d.mts +6 -6
  42. package/dist/internal/sized/map.d.mts +2 -2
  43. package/dist/internal/value/compare.d.mts +7 -19
  44. package/dist/internal/value/equal.d.mts +8 -31
  45. package/dist/internal/value/handlers.d.mts +2 -5
  46. package/dist/internal/value/has.d.mts +3 -3
  47. package/dist/is.d.mts +6 -6
  48. package/dist/is.mjs +2 -2
  49. package/dist/promise/helpers.d.mts +2 -2
  50. package/dist/promise/index.d.mts +7 -7
  51. package/dist/promise/models.d.mts +1 -1
  52. package/dist/promise/timed.d.mts +1 -1
  53. package/dist/queue.d.mts +1 -1
  54. package/dist/result/index.d.mts +1 -1
  55. package/dist/result/index.mjs +3 -1
  56. package/dist/result/match.d.mts +3 -3
  57. package/dist/result/work/flow.d.mts +1 -1
  58. package/dist/result/work/pipe.d.mts +1 -1
  59. package/dist/sized/set.d.mts +1 -1
  60. package/dist/string/fuzzy.d.mts +4 -4
  61. package/dist/string/normalize.d.mts +1 -1
  62. package/dist/string/template.d.mts +1 -2
  63. package/dist/value/clone.d.mts +8 -20
  64. package/dist/value/diff.d.mts +1 -1
  65. package/dist/value/freeze.d.mts +4 -4
  66. package/dist/value/merge.d.mts +5 -5
  67. package/dist/value/transform.d.mts +1 -1
  68. package/package.json +25 -10
  69. package/plugin/index.js +1 -1
package/dist/index.d.mts CHANGED
@@ -75,7 +75,7 @@ export type NumericalValues<Item extends PlainObject> = { [ItemKey in keyof Item
75
75
  /**
76
76
  * An asynchronous function that can only be called once, returning the same value on subsequent calls
77
77
  */
78
- type OnceAsync<Callback extends GenericAsyncCallback> = {
78
+ export type OnceAsync<Callback extends GenericAsyncCallback> = {
79
79
  /**
80
80
  * Did the callback's promise reject?
81
81
  */
@@ -95,7 +95,7 @@ type OnceAsync<Callback extends GenericAsyncCallback> = {
95
95
  /**
96
96
  * A callback function that can only be called once, returning the same value on subsequent calls
97
97
  */
98
- type Once<Callback extends GenericCallback> = {
98
+ export type Once<Callback extends GenericCallback> = {
99
99
  /**
100
100
  * Run the callback
101
101
  *
@@ -307,7 +307,150 @@ export declare function filter<Item>(array: Item[], filter: (item: Item, index:
307
307
  */
308
308
  export declare function filter<Item>(array: Item[], item: Item): Item[];
309
309
  export declare namespace filter {
310
- var remove: typeof exclude;
310
+ export var remove: typeof exclude;
311
+ }
312
+ //#endregion
313
+ //#region src/array/find.d.ts
314
+ /**
315
+ * Get the first item matching the given value
316
+ *
317
+ * @param array Array to search in
318
+ * @param callback Callback to get an item's value for matching
319
+ * @param value Value to match against
320
+ * @returns First item that matches the value, or `undefined` if no match is found
321
+ *
322
+ * @example
323
+ * ```typescript
324
+ * find(
325
+ * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
326
+ * item => item.value,
327
+ * 10,
328
+ * ); // => {id: 1, value: 10}
329
+ * ```
330
+ */
331
+ export declare function find<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): Item | undefined;
332
+ /**
333
+ * Get the first item matching the given value by key
334
+ *
335
+ * @param array Array to search in
336
+ * @param key Key to get an item's value for matching
337
+ * @param value Value to match against
338
+ * @returns First item that matches the value, or `undefined` if no match is found
339
+ *
340
+ * @example
341
+ * ```typescript
342
+ * find(
343
+ * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
344
+ * 'value',
345
+ * 10,
346
+ * ); // => {id: 1, value: 10}
347
+ * ```
348
+ */
349
+ export declare function find<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item | undefined;
350
+ /**
351
+ * Get the first item matching the filter
352
+ *
353
+ * @param array Array to search in
354
+ * @param filter Filter callback to match items
355
+ * @returns First item that matches the filter, or `undefined` if no match is found
356
+ *
357
+ * @example
358
+ * ```typescript
359
+ * find(
360
+ * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
361
+ * item => item.value === 10,
362
+ * ); // => {id: 1, value: 10}
363
+ * ```
364
+ */
365
+ export declare function find<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): Item | undefined;
366
+ /**
367
+ * Get the first item matching the given value
368
+ *
369
+ * @param array Array to search in
370
+ * @param value Value to match against
371
+ * @returns First item that matches the value, or `undefined` if no match is found
372
+ *
373
+ * @example
374
+ * ```typescript
375
+ * find([1, 2, 3, 2, 1], 1); // => 1
376
+ * ```
377
+ */
378
+ export declare function find<Item>(array: Item[], value: Item): Item | undefined;
379
+ /**
380
+ * Get the last item matching the given value
381
+ *
382
+ * _Available as `findLast` and `find.last`_
383
+ *
384
+ * @param array Array to search in
385
+ * @param callback Callback to get an item's value for matching
386
+ * @param value Value to match against
387
+ * @returns Last item that matches the value, or `undefined` if no match is found
388
+ *
389
+ * @example
390
+ * ```typescript
391
+ * findLast(
392
+ * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
393
+ * item => item.value,
394
+ * 10,
395
+ * ); // => {id: 3, value: 10}
396
+ * ```
397
+ */
398
+ export declare function findLast<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): Item | undefined;
399
+ /**
400
+ * Get the last item matching the given value by key
401
+ *
402
+ * _Available as `findLast` and `find.last`_
403
+ *
404
+ * @param array Array to search in
405
+ * @param key Key to get an item's value for matching
406
+ * @param value Value to match against
407
+ * @returns Last item that matches the value, or `undefined` if no match is found
408
+ *
409
+ * @example
410
+ * ```typescript
411
+ * findLast(
412
+ * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
413
+ * 'value',
414
+ * 10,
415
+ * ); // => {id: 3, value: 10}
416
+ * ```
417
+ */
418
+ export declare function findLast<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item | undefined;
419
+ /**
420
+ * Get the last item matching the filter
421
+ *
422
+ * _Available as `findLast` and `find.last`_
423
+ *
424
+ * @param array Array to search in
425
+ * @param filter Filter callback to match items
426
+ * @returns Last item that matches the filter, or `undefined` if no match is found
427
+ *
428
+ * @example
429
+ * ```typescript
430
+ * findLast(
431
+ * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
432
+ * item => item.value === 10,
433
+ * ); // => {id: 3, value: 10}
434
+ * ```
435
+ */
436
+ export declare function findLast<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): Item | undefined;
437
+ /**
438
+ * Get the last item matching the given value
439
+ *
440
+ * _Available as `findLast` and `find.last`_
441
+ *
442
+ * @param array Array to search in
443
+ * @param value Value to match against
444
+ * @returns Last item that matches the value, or `undefined` if no match is found
445
+ *
446
+ * @example
447
+ * ```typescript
448
+ * findLast([1, 2, 3, 2, 1], 1); // => 1
449
+ * ```
450
+ */
451
+ export declare function findLast<Item>(array: Item[], value: Item): Item | undefined;
452
+ export declare namespace find {
453
+ export var last: typeof findLast;
311
454
  }
312
455
  //#endregion
313
456
  //#region src/array/first.d.ts
@@ -377,10 +520,6 @@ export declare function first<Item>(array: Item[], filter: (item: Item, index: n
377
520
  * ```
378
521
  */
379
522
  export declare function first<Item>(array: Item[]): Item | undefined;
380
- export declare namespace first {
381
- var _a: typeof firstOrDefault;
382
- export { _a as default };
383
- }
384
523
  /**
385
524
  * Get the first item matching the given value, or a default value if no match is found
386
525
  *
@@ -460,6 +599,9 @@ export declare function firstOrDefault<Item>(array: Item[], defaultValue: Item,
460
599
  * ```
461
600
  */
462
601
  export declare function firstOrDefault<Item>(array: Item[], defaultValue: Item): Item;
602
+ export declare namespace first {
603
+ export var defaulted: typeof firstOrDefault;
604
+ }
463
605
  //#endregion
464
606
  //#region src/array/group-by.d.ts
465
607
  /**
@@ -514,9 +656,6 @@ export declare function groupBy<Item, KeyArg extends KeyOrCallback<Item, Key$1>>
514
656
  * ```
515
657
  */
516
658
  export declare function groupBy<Item>(array: Item[]): Record<number, Item>;
517
- export declare namespace groupBy {
518
- var arrays: typeof groupArraysBy;
519
- }
520
659
  /**
521
660
  * Create a record from an array of items using a specific key, grouping values into arrays
522
661
  *
@@ -561,6 +700,9 @@ export declare function groupArraysBy<Item, KeyArg extends KeyOrCallback<Item, K
561
700
  * ```
562
701
  */
563
702
  export declare function groupArraysBy<Item, KeyArg extends KeyOrCallback<Item, Key$1>>(array: Item[], key: KeyArg): Simplify<Record<KeyOrCallbackKey<Item, KeyArg>, Item[]>>;
703
+ export declare namespace groupBy {
704
+ export var arrays: typeof groupArraysBy;
705
+ }
564
706
  //#endregion
565
707
  //#region src/internal/array/chunk.d.ts
566
708
  /**
@@ -590,7 +732,7 @@ export declare function chunk<Item>(array: Item[], size?: number): Item[][];
590
732
  * compact([0, 1, '', 'hello', false, true, null, undefined]); // => [1, 'hello', true]
591
733
  * ```
592
734
  */
593
- export declare function compact<Item>(array: Item[], strict: true): Array<Exclude<Item, 0 | '' | false | null | undefined>>;
735
+ export declare function compact<Item>(array: Item[], strict: true): Array<Exclude<Item, 0 | "" | false | null | undefined>>;
594
736
  /**
595
737
  * Compact an array _(removing all `null` and `undefined` values)_
596
738
  *
@@ -682,245 +824,102 @@ export declare function getArray<Item>(value: Item[]): Item[];
682
824
  */
683
825
  export declare function getArray<Value>(value: Value): Value[];
684
826
  //#endregion
685
- //#region src/internal/array/index-of.d.ts
827
+ //#region src/internal/array/match.d.ts
686
828
  /**
687
- * Get the index of the first matching item by callback
829
+ * Comparison of an array within another array
830
+ */
831
+ export type ArrayComparison = "end" | "inside" | "invalid" | "outside" | "same" | "start";
832
+ /**
833
+ * Is the needle array at the end of the haystack array?
688
834
  *
689
- * @param array Array to search in
690
- * @param callback Callback to get an item's value
691
- * @param value Value to match against
692
- * @returns Index of the first matching item, or `-1` if no match is found
835
+ * @param haystack Haystack array
836
+ * @param needle Needle array
837
+ * @param callback Callback to get an item's value for matching
838
+ * @returns `true` if the haystack ends with the needle, otherwise `false`
693
839
  *
694
840
  * @example
695
841
  * ```typescript
696
- * indexOf(
842
+ * endsWithArray(
697
843
  * [{id: 1}, {id: 2}, {id: 3}],
844
+ * [{id: 2}, {id: 3}],
698
845
  * item => item.id,
699
- * 2,
700
- * ); // => 1
846
+ * ); // => true
701
847
  * ```
702
848
  */
703
- export declare function indexOf<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): number;
849
+ export declare function endsWithArray<Item>(haystack: Item[], needle: Item[], callback: (item: Item, index: number, array: Item[]) => unknown): boolean;
704
850
  /**
705
- * Get the index of the first matching item by key
851
+ * Is the needle array at the end of the haystack array?
706
852
  *
707
- * @param array Array to search in
708
- * @param key Key to match items by
709
- * @param value Value to match against
710
- * @returns Index of the first matching item, or `-1` if no match is found
853
+ * @param haystack Haystack array
854
+ * @param needle Needle array
855
+ * @param key Key to get an item's value for matching
856
+ * @returns `true` if the haystack ends with the needle, otherwise `false`
711
857
  *
712
858
  * @example
713
859
  * ```typescript
714
- * indexOf(
860
+ * endsWithArray(
715
861
  * [{id: 1}, {id: 2}, {id: 3}],
862
+ * [{id: 2}, {id: 3}],
716
863
  * 'id',
717
- * 2,
718
- * ); // => 1
864
+ * ); // => true
719
865
  * ```
720
866
  */
721
- export declare function indexOf<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): number;
867
+ export declare function endsWithArray<Item extends PlainObject>(haystack: Item[], needle: Item[], key: keyof Item): boolean;
722
868
  /**
723
- * Get the index of the first item matching the filter
869
+ * Is the needle array at the end of the haystack array?
724
870
  *
725
- * @param array Array to search in
726
- * @param filter Filter callback to match items
727
- * @returns Index of the first matching item, or `-1` if no match is found
871
+ * @param haystack Haystack array
872
+ * @param needle Needle array
873
+ * @returns `true` if the haystack ends with the needle, otherwise `false`
728
874
  *
729
875
  * @example
730
876
  * ```typescript
731
- * indexOf(
732
- * [{id: 1}, {id: 2}, {id: 3}],
733
- * item => item.id === 2,
734
- * ); // => 1
877
+ * endsWithArray([1, 2, 3], [2, 3]); // => true
735
878
  * ```
736
879
  */
737
- export declare function indexOf<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): number;
880
+ export declare function endsWithArray<Item>(haystack: Item[], needle: Item[]): boolean;
738
881
  /**
739
- * Get the index of the first item matching the given item
882
+ * Get the position of an array within another array
740
883
  *
741
- * @param array Array to search in
742
- * @param item Item to match against
743
- * @returns Index of the first matching item, or `-1` if no match is found
884
+ * @param haystack Haystack array
885
+ * @param needle Needle array
886
+ * @param callback Callback to get an item's value for matching
887
+ * @returns Position of the needle within the haystack
744
888
  *
745
889
  * @example
746
890
  * ```typescript
747
- * indexOf([1, 2, 3, 4, 5], 3); // => 2
891
+ * getArrayComparison(
892
+ * [{id: 1}, {id: 2}, {id: 3}],
893
+ * [{id: 2}, {id: 3}],
894
+ * item => item.id,
895
+ * ); // => 'end'
748
896
  * ```
749
897
  */
750
- export declare function indexOf<Item>(array: Item[], item: Item): number;
751
- export declare namespace indexOf {
752
- var last: typeof lastIndexOf;
753
- }
898
+ export declare function getArrayComparison<Item>(haystack: Item[], needle: Item[], callback: (item: Item, index: number, array: Item[]) => unknown): ArrayComparison;
754
899
  /**
755
- * Get the index of the last matching item by callback
756
- *
757
- * _Available as `lastIndexOf` and `indexOf.last`_
900
+ * Get the position of an array within another array
758
901
  *
759
- * @param array Array to search in
760
- * @param callback Callback to get an item's value
761
- * @param value Value to match against
762
- * @returns Index of the last matching item, or `-1` if no match is found
902
+ * @param haystack Haystack array
903
+ * @param needle Needle array
904
+ * @param key Key to get an item's value for matching
905
+ * @returns Position of the needle within the haystack
763
906
  *
764
907
  * @example
765
908
  * ```typescript
766
- * lastIndexOf(
767
- * [{id: 1}, {id: 2}, {id: 3}, {id: 2}],
768
- * item => item.id,
769
- * 2,
770
- * ); // => 3
909
+ * getArrayComparison(
910
+ * [{id: 1}, {id: 2}, {id: 3}],
911
+ * [{id: 2}, {id: 3}],
912
+ * 'id',
913
+ * ); // => 'end'
771
914
  * ```
772
915
  */
773
- export declare function lastIndexOf<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): number;
916
+ export declare function getArrayComparison<Item extends PlainObject>(haystack: Item[], needle: Item[], key: keyof Item): ArrayComparison;
774
917
  /**
775
- * Get the index of the last matching item by key
918
+ * Get the position of an array within another array
776
919
  *
777
- * _Available as `lastIndexOf` and `indexOf.last`_
778
- *
779
- * @param array Array to search in
780
- * @param key Key to match items by
781
- * @param value Value to match against
782
- * @returns Index of the last matching item, or `-1` if no match is found
783
- *
784
- * @example
785
- * ```typescript
786
- * lastIndexOf(
787
- * [{id: 1}, {id: 2}, {id: 3}, {id: 2}],
788
- * 'id',
789
- * 2,
790
- * ); // => 3
791
- * ```
792
- */
793
- export declare function lastIndexOf<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): number;
794
- /**
795
- * Get the index of the last item matching the filter
796
- *
797
- * _Available as `lastIndexOf` and `indexOf.last`_
798
- *
799
- * @param array Array to search in
800
- * @param filter Filter callback to match items
801
- * @returns Index of the last matching item, or `-1` if no match is found
802
- *
803
- * @example
804
- * ```typescript
805
- * lastIndexOf(
806
- * [{id: 1}, {id: 2}, {id: 3}, {id: 2}],
807
- * item => item.id === 2,
808
- * ); // => 3
809
- * ```
810
- */
811
- export declare function lastIndexOf<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): number;
812
- /**
813
- * Get the index of the last item matching the given item
814
- *
815
- * _Available as `lastIndexOf` and `indexOf.last`_
816
- *
817
- * @param array Array to search in
818
- * @param item Item to match against
819
- * @returns Index of the last matching item, or `-1` if no match is found
820
- *
821
- * @example
822
- * ```typescript
823
- * lastIndexOf([1, 2, 3, 2, 1], 2); // => 3
824
- * ```
825
- */
826
- export declare function lastIndexOf<Item>(array: Item[], item: Item): number;
827
- //#endregion
828
- //#region src/internal/array/match.d.ts
829
- /**
830
- * Comparison of an array within another array
831
- */
832
- export type ArrayComparison = 'end' | 'inside' | 'invalid' | 'outside' | 'same' | 'start';
833
- /**
834
- * Is the needle array at the end of the haystack array?
835
- *
836
- * @param haystack Haystack array
837
- * @param needle Needle array
838
- * @param callback Callback to get an item's value for matching
839
- * @returns `true` if the haystack ends with the needle, otherwise `false`
840
- *
841
- * @example
842
- * ```typescript
843
- * endsWithArray(
844
- * [{id: 1}, {id: 2}, {id: 3}],
845
- * [{id: 2}, {id: 3}],
846
- * item => item.id,
847
- * ); // => true
848
- * ```
849
- */
850
- export declare function endsWithArray<Item>(haystack: Item[], needle: Item[], callback: (item: Item, index: number, array: Item[]) => unknown): boolean;
851
- /**
852
- * Is the needle array at the end of the haystack array?
853
- *
854
- * @param haystack Haystack array
855
- * @param needle Needle array
856
- * @param key Key to get an item's value for matching
857
- * @returns `true` if the haystack ends with the needle, otherwise `false`
858
- *
859
- * @example
860
- * ```typescript
861
- * endsWithArray(
862
- * [{id: 1}, {id: 2}, {id: 3}],
863
- * [{id: 2}, {id: 3}],
864
- * 'id',
865
- * ); // => true
866
- * ```
867
- */
868
- export declare function endsWithArray<Item extends PlainObject>(haystack: Item[], needle: Item[], key: keyof Item): boolean;
869
- /**
870
- * Is the needle array at the end of the haystack array?
871
- *
872
- * @param haystack Haystack array
873
- * @param needle Needle array
874
- * @returns `true` if the haystack ends with the needle, otherwise `false`
875
- *
876
- * @example
877
- * ```typescript
878
- * endsWithArray([1, 2, 3], [2, 3]); // => true
879
- * ```
880
- */
881
- export declare function endsWithArray<Item>(haystack: Item[], needle: Item[]): boolean;
882
- /**
883
- * Get the position of an array within another array
884
- *
885
- * @param haystack Haystack array
886
- * @param needle Needle array
887
- * @param callback Callback to get an item's value for matching
888
- * @returns Position of the needle within the haystack
889
- *
890
- * @example
891
- * ```typescript
892
- * getArrayComparison(
893
- * [{id: 1}, {id: 2}, {id: 3}],
894
- * [{id: 2}, {id: 3}],
895
- * item => item.id,
896
- * ); // => 'end'
897
- * ```
898
- */
899
- export declare function getArrayComparison<Item>(haystack: Item[], needle: Item[], callback: (item: Item, index: number, array: Item[]) => unknown): ArrayComparison;
900
- /**
901
- * Get the position of an array within another array
902
- *
903
- * @param haystack Haystack array
904
- * @param needle Needle array
905
- * @param key Key to get an item's value for matching
906
- * @returns Position of the needle within the haystack
907
- *
908
- * @example
909
- * ```typescript
910
- * getArrayComparison(
911
- * [{id: 1}, {id: 2}, {id: 3}],
912
- * [{id: 2}, {id: 3}],
913
- * 'id',
914
- * ); // => 'end'
915
- * ```
916
- */
917
- export declare function getArrayComparison<Item extends PlainObject>(haystack: Item[], needle: Item[], key: keyof Item): ArrayComparison;
918
- /**
919
- * Get the position of an array within another array
920
- *
921
- * @param haystack Haystack array
922
- * @param needle Needle array
923
- * @returns Position of the needle within the haystack
920
+ * @param haystack Haystack array
921
+ * @param needle Needle array
922
+ * @returns Position of the needle within the haystack
924
923
  *
925
924
  * @example
926
925
  * ```typescript
@@ -1206,234 +1205,91 @@ export declare function exists<Item>(array: Item[], filter: (item: Item, index:
1206
1205
  */
1207
1206
  export declare function exists<Item>(array: Item[], item: Item): boolean;
1208
1207
  //#endregion
1209
- //#region src/array/find.d.ts
1208
+ //#region src/array/flatten.d.ts
1210
1209
  /**
1211
- * Get the first item matching the given value
1210
+ * Flatten an array _(using native `flat` and maximum depth)_
1212
1211
  *
1213
- * @param array Array to search in
1214
- * @param callback Callback to get an item's value for matching
1215
- * @param value Value to match against
1216
- * @returns First item that matches the value, or `undefined` if no match is found
1212
+ * @param array Array to flatten
1213
+ * @returns Flattened array
1217
1214
  *
1218
1215
  * @example
1219
1216
  * ```typescript
1220
- * find(
1221
- * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
1222
- * item => item.value,
1223
- * 10,
1224
- * ); // => {id: 1, value: 10}
1217
+ * flatten([1, [2, [3, 4], 5], 6]); // => [1, 2, 3, 4, 5, 6]
1225
1218
  * ```
1226
1219
  */
1227
- export declare function find<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): Item | undefined;
1220
+ export declare function flatten<Item>(array: Item[]): Array<NestedArray<Item>>;
1221
+ //#endregion
1222
+ //#region src/array/from.d.ts
1228
1223
  /**
1229
- * Get the first item matching the given value by key
1224
+ * Get an array with a specified length, filled with indices
1230
1225
  *
1231
- * @param array Array to search in
1232
- * @param key Key to get an item's value for matching
1233
- * @param value Value to match against
1234
- * @returns First item that matches the value, or `undefined` if no match is found
1226
+ * @param length Length of the array
1227
+ * @returns Array of indices
1235
1228
  *
1236
1229
  * @example
1237
1230
  * ```typescript
1238
- * find(
1239
- * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
1240
- * 'value',
1241
- * 10,
1242
- * ); // => {id: 1, value: 10}
1231
+ * range(5); // => [0, 1, 2, 3, 4]
1243
1232
  * ```
1244
1233
  */
1245
- export declare function find<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item | undefined;
1234
+ export declare function range(length: number): number[];
1246
1235
  /**
1247
- * Get the first item matching the filter
1236
+ * Get an array of numbers in a specified range
1248
1237
  *
1249
- * @param array Array to search in
1250
- * @param filter Filter callback to match items
1251
- * @returns First item that matches the filter, or `undefined` if no match is found
1238
+ * @param start Starting number _(inclusive)_
1239
+ * @param end Ending number _(exclusive)_
1240
+ * @returns Array of numbers in range
1252
1241
  *
1253
1242
  * @example
1254
1243
  * ```typescript
1255
- * find(
1256
- * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
1257
- * item => item.value === 10,
1258
- * ); // => {id: 1, value: 10}
1244
+ * range(2, 5); // => [2, 3, 4]
1259
1245
  * ```
1260
1246
  */
1261
- export declare function find<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): Item | undefined;
1247
+ export declare function range(start: number, end: number): number[];
1262
1248
  /**
1263
- * Get the first item matching the given value
1249
+ * Get an array of numbers in a specified range with a specified step
1264
1250
  *
1265
- * @param array Array to search in
1266
- * @param value Value to match against
1267
- * @returns First item that matches the value, or `undefined` if no match is found
1251
+ * @param start Starting number _(inclusive)_
1252
+ * @param end Ending number _(exclusive)_
1253
+ * @param step Step between numbers
1254
+ * @returns Array of numbers in range
1268
1255
  *
1269
1256
  * @example
1270
1257
  * ```typescript
1271
- * find([1, 2, 3, 2, 1], 1); // => 1
1258
+ * range(0, 10, 2); // => [0, 2, 4, 6, 8]
1272
1259
  * ```
1273
1260
  */
1274
- export declare function find<Item>(array: Item[], value: Item): Item | undefined;
1275
- export declare namespace find {
1276
- var last: typeof findLast;
1277
- }
1261
+ export declare function range(start: number, end: number, step: number): number[];
1278
1262
  /**
1279
- * Get the last item matching the given value
1280
- *
1281
- * _Available as `findLast` and `find.last`_
1263
+ * Get an array with a specified length, filled with indices
1282
1264
  *
1283
- * @param array Array to search in
1284
- * @param callback Callback to get an item's value for matching
1285
- * @param value Value to match against
1286
- * @returns Last item that matches the value, or `undefined` if no match is found
1265
+ * @param length Length of the array
1266
+ * @returns Array of indices
1287
1267
  *
1288
1268
  * @example
1289
1269
  * ```typescript
1290
- * findLast(
1291
- * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
1292
- * item => item.value,
1293
- * 10,
1294
- * ); // => {id: 3, value: 10}
1270
+ * times(5); // => [0, 1, 2, 3, 4]
1295
1271
  * ```
1296
1272
  */
1297
- export declare function findLast<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): Item | undefined;
1273
+ export declare function times(length: number): number[];
1298
1274
  /**
1299
- * Get the last item matching the given value by key
1300
- *
1301
- * _Available as `findLast` and `find.last`_
1275
+ * Get an array with a specified length, filled by values from a callback
1302
1276
  *
1303
- * @param array Array to search in
1304
- * @param key Key to get an item's value for matching
1305
- * @param value Value to match against
1306
- * @returns Last item that matches the value, or `undefined` if no match is found
1277
+ * @param length Length of the array
1278
+ * @param callback Callback function to generate values
1279
+ * @returns Array of values generated by the callback
1307
1280
  *
1308
1281
  * @example
1309
1282
  * ```typescript
1310
- * findLast(
1311
- * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
1312
- * 'value',
1313
- * 10,
1314
- * ); // => {id: 3, value: 10}
1283
+ * times(5, index => index * 2); // => [0, 2, 4, 6, 8]
1315
1284
  * ```
1316
1285
  */
1317
- export declare function findLast<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item | undefined;
1286
+ export declare function times<Callback extends (index: number) => unknown>(length: number, callback: Callback): Array<ReturnType<Callback>>;
1318
1287
  /**
1319
- * Get the last item matching the filter
1288
+ * Get an array with a specified length, filled with a specified value
1320
1289
  *
1321
- * _Available as `findLast` and `find.last`_
1322
- *
1323
- * @param array Array to search in
1324
- * @param filter Filter callback to match items
1325
- * @returns Last item that matches the filter, or `undefined` if no match is found
1326
- *
1327
- * @example
1328
- * ```typescript
1329
- * findLast(
1330
- * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
1331
- * item => item.value === 10,
1332
- * ); // => {id: 3, value: 10}
1333
- * ```
1334
- */
1335
- export declare function findLast<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): Item | undefined;
1336
- /**
1337
- * Get the last item matching the given value
1338
- *
1339
- * _Available as `findLast` and `find.last`_
1340
- *
1341
- * @param array Array to search in
1342
- * @param value Value to match against
1343
- * @returns Last item that matches the value, or `undefined` if no match is found
1344
- *
1345
- * @example
1346
- * ```typescript
1347
- * findLast([1, 2, 3, 2, 1], 1); // => 1
1348
- * ```
1349
- */
1350
- export declare function findLast<Item>(array: Item[], value: Item): Item | undefined;
1351
- //#endregion
1352
- //#region src/array/flatten.d.ts
1353
- /**
1354
- * Flatten an array _(using native `flat` and maximum depth)_
1355
- *
1356
- * @param array Array to flatten
1357
- * @returns Flattened array
1358
- *
1359
- * @example
1360
- * ```typescript
1361
- * flatten([1, [2, [3, 4], 5], 6]); // => [1, 2, 3, 4, 5, 6]
1362
- * ```
1363
- */
1364
- export declare function flatten<Item>(array: Item[]): Array<NestedArray<Item>>;
1365
- //#endregion
1366
- //#region src/array/from.d.ts
1367
- /**
1368
- * Get an array with a specified length, filled with indices
1369
- *
1370
- * @param length Length of the array
1371
- * @returns Array of indices
1372
- *
1373
- * @example
1374
- * ```typescript
1375
- * range(5); // => [0, 1, 2, 3, 4]
1376
- * ```
1377
- */
1378
- export declare function range(length: number): number[];
1379
- /**
1380
- * Get an array of numbers in a specified range
1381
- *
1382
- * @param start Starting number _(inclusive)_
1383
- * @param end Ending number _(exclusive)_
1384
- * @returns Array of numbers in range
1385
- *
1386
- * @example
1387
- * ```typescript
1388
- * range(2, 5); // => [2, 3, 4]
1389
- * ```
1390
- */
1391
- export declare function range(start: number, end: number): number[];
1392
- /**
1393
- * Get an array of numbers in a specified range with a specified step
1394
- *
1395
- * @param start Starting number _(inclusive)_
1396
- * @param end Ending number _(exclusive)_
1397
- * @param step Step between numbers
1398
- * @returns Array of numbers in range
1399
- *
1400
- * @example
1401
- * ```typescript
1402
- * range(0, 10, 2); // => [0, 2, 4, 6, 8]
1403
- * ```
1404
- */
1405
- export declare function range(start: number, end: number, step: number): number[];
1406
- /**
1407
- * Get an array with a specified length, filled with indices
1408
- *
1409
- * @param length Length of the array
1410
- * @returns Array of indices
1411
- *
1412
- * @example
1413
- * ```typescript
1414
- * times(5); // => [0, 1, 2, 3, 4]
1415
- * ```
1416
- */
1417
- export declare function times(length: number): number[];
1418
- /**
1419
- * Get an array with a specified length, filled by values from a callback
1420
- *
1421
- * @param length Length of the array
1422
- * @param callback Callback function to generate values
1423
- * @returns Array of values generated by the callback
1424
- *
1425
- * @example
1426
- * ```typescript
1427
- * times(5, index => index * 2); // => [0, 2, 4, 6, 8]
1428
- * ```
1429
- */
1430
- export declare function times<Callback extends (index: number) => unknown>(length: number, callback: Callback): Array<ReturnType<Callback>>;
1431
- /**
1432
- * Get an array with a specified length, filled with a specified value
1433
- *
1434
- * @param length Length of the array
1435
- * @param value Value to fill the array with
1436
- * @returns Array filled with the specified value
1290
+ * @param length Length of the array
1291
+ * @param value Value to fill the array with
1292
+ * @returns Array filled with the specified value
1437
1293
  *
1438
1294
  * @example
1439
1295
  * ```typescript
@@ -1622,301 +1478,121 @@ export declare function push<Item>(array: Item[], pushed: Item[]): number;
1622
1478
  */
1623
1479
  export declare function reverse<Item>(array: Item[]): Item[];
1624
1480
  //#endregion
1625
- //#region src/array/select.d.ts
1626
- type MapKeyOrCallback<Item> = ((item: Item, index: number, array: Item[]) => unknown) | (Item extends PlainObject ? keyof Item : never);
1627
- type Mapped<Item, Map extends MapKeyOrCallback<Item>> = Map extends ((item: Item, index: number, array: Item[]) => unknown) ? ReturnType<Map> : Map extends keyof Item ? Item[Map] : never;
1628
- type ObjectKeysOf<Item> = { [Key in keyof Item]: Item[Key] extends PlainObject ? Key : never; }[keyof Item];
1481
+ //#region src/array/single.d.ts
1629
1482
  /**
1630
- * Get a mapped and filtered array of items
1483
+ * Get the _only_ item matching the given value
1484
+ *
1485
+ * Throws an error if multiple items match the value
1631
1486
  *
1632
1487
  * @param array Array to search in
1633
- * @param map Callback or key to map the items
1634
- * @param filterCallback Callback to get a mapped value's value for matching
1635
- * @param filterValue Value to match against
1636
- * @returns Mapped and filtered array of items
1488
+ * @param callback Callback to get an item's value for matching
1489
+ * @param value Value to match against
1490
+ * @returns Only item that matches the value, or `undefined` if no match is found
1637
1491
  *
1638
1492
  * @example
1639
1493
  * ```typescript
1640
- * reverseSelect(
1641
- * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
1642
- * item => item.name,
1643
- * value => value.length,
1644
- * 3,
1645
- * ); // => ['Bob']
1494
+ * single(
1495
+ * [{id: 1}, {id: 2}, {id: 3}],
1496
+ * item => item.id,
1497
+ * 2
1498
+ * ); // => {id: 2}
1646
1499
  * ```
1647
1500
  */
1648
- export declare function reverseSelect<Item, Map extends MapKeyOrCallback<Item>, FilterCallback extends (item: Mapped<Item, Map>, index: number, array: Item[]) => unknown>(array: Item[], map: Map, filterCallback: FilterCallback, filterValue: ReturnType<FilterCallback>): Array<Mapped<Item, Map>>;
1501
+ export declare function single<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): Item | undefined;
1649
1502
  /**
1650
- * Get a mapped and filtered array of items
1503
+ * Get the _only_ item matching the given value by key
1504
+ *
1505
+ * Throws an error if multiple items match the value
1651
1506
  *
1652
1507
  * @param array Array to search in
1653
- * @param map Callback to map the items
1654
- * @param filterKey Key to get a mapped value's value for matching
1655
- * @param filterValue Value to match against
1656
- * @returns Mapped and filtered array of items
1508
+ * @param key Key to get an item's value for matching
1509
+ * @param value Value to match against
1510
+ * @returns Only item that matches the value, or `undefined` if no match is found
1657
1511
  *
1658
1512
  * @example
1659
1513
  * ```typescript
1660
- * reverseSelect(
1661
- * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
1662
- * item => ({label: item.name}),
1663
- * 'label',
1664
- * 'Bob',
1665
- * ); // => [{label: 'Bob'}]
1514
+ * single(
1515
+ * [{id: 1}, {id: 2}, {id: 3}],
1516
+ * 'id',
1517
+ * 2
1518
+ * ); // => {id: 2}
1666
1519
  * ```
1667
1520
  */
1668
- export declare function reverseSelect<Item, MapCallback extends (item: Item, index: number, array: Item[]) => PlainObject, ItemKey extends keyof ReturnType<MapCallback>>(array: Item[], map: MapCallback, filterKey: ItemKey, filterValue: ReturnType<MapCallback>[ItemKey]): Array<ReturnType<MapCallback>>;
1521
+ export declare function single<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item | undefined;
1669
1522
  /**
1670
- * Get a mapped and filtered array of items
1523
+ * Get the _only_ item matching the filter
1524
+ *
1525
+ * Throws an error if multiple items match the filter
1671
1526
  *
1672
1527
  * @param array Array to search in
1673
- * @param map Key to map the items
1674
- * @param filterKey Key to get a mapped value's value for matching
1675
- * @param filterValue Value to match against
1676
- * @returns Mapped and filtered array of items
1528
+ * @param filter Filter callback to match items
1529
+ * @returns Only item that matches the filter, or `undefined` if no match is found
1677
1530
  *
1678
1531
  * @example
1679
1532
  * ```typescript
1680
- * reverseSelect(
1681
- * [{meta: {tag: 'a'}}, {meta: {tag: 'b'}}],
1682
- * 'meta',
1683
- * 'tag',
1684
- * 'b',
1685
- * ); // => [{tag: 'b'}]
1533
+ * single(
1534
+ * [{id: 1}, {id: 2}, {id: 3}],
1535
+ * item => item.id === 2
1536
+ * ); // => {id: 2}
1686
1537
  * ```
1687
1538
  */
1688
- export declare function reverseSelect<Item, MapKey extends ObjectKeysOf<Item>, ItemKey extends keyof Item[MapKey]>(array: Item[], map: MapKey, filterKey: ItemKey, filterValue: Item[MapKey][ItemKey]): Array<Item[MapKey]>;
1539
+ export declare function single<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): Item | undefined;
1540
+ //#endregion
1541
+ //#region src/array/slice.d.ts
1689
1542
  /**
1690
- * Get a mapped and filtered array of items
1543
+ * Drop items from the start of an array until they match a value
1691
1544
  *
1692
- * @param array Array to search in
1693
- * @param map Callback or key to map the items
1694
- * @param filter Filter callback to match mapped values
1695
- * @returns Mapped and filtered array of items
1545
+ * @param array Original array
1546
+ * @param callback Callback to get an item's value for matching
1547
+ * @param value Value to match against
1548
+ * @returns New array with items dropped
1696
1549
  *
1697
1550
  * @example
1698
1551
  * ```typescript
1699
- * reverseSelect(
1700
- * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
1701
- * item => item.name,
1702
- * value => value.startsWith('B'),
1703
- * ); // => ['Bob']
1552
+ * drop(
1553
+ * [{id: 1}, {id: 2}, {id: 3}],
1554
+ * item => item.id,
1555
+ * 2,
1556
+ * ); // => [{id: 2}, {id: 3}]
1704
1557
  * ```
1705
1558
  */
1706
- export declare function reverseSelect<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], map: Map, filter: (item: Mapped<Item, Map>, index: number, array: Item[]) => boolean): Array<Mapped<Item, Map>>;
1559
+ export declare function drop<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): Item[];
1707
1560
  /**
1708
- * Get a mapped and filtered array of items
1561
+ * Drop items from the start of an array until they match a value
1709
1562
  *
1710
- * @param array Array to search in
1711
- * @param map Callback or key to map the items
1712
- * @param value Mapped value to match against
1713
- * @returns Mapped and filtered array of items
1563
+ * @param array Original array
1564
+ * @param key Key to get an item's value for matching
1565
+ * @param value Value to match against
1566
+ * @returns New array with items dropped
1714
1567
  *
1715
1568
  * @example
1716
1569
  * ```typescript
1717
- * reverseSelect(
1718
- * [1, 2, 3, 2, 1],
1719
- * value => value ** 2,
1720
- * 4,
1721
- * ); // => [4, 4]
1570
+ * drop(
1571
+ * [{id: 1}, {id: 2}, {id: 3}],
1572
+ * 'id',
1573
+ * 2,
1574
+ * ); // => [{id: 2}, {id: 3}]
1722
1575
  * ```
1723
1576
  */
1724
- export declare function reverseSelect<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], map: Map, value: Mapped<Item, Map>): Array<Mapped<Item, Map>>;
1577
+ export declare function drop<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item[];
1725
1578
  /**
1726
- * Get a filtered and mapped array of items
1579
+ * Drop items from the start of an array while they match a filter
1727
1580
  *
1728
- * @param array Array to search in
1729
- * @param filterCallback Callback to get an item's value for matching
1730
- * @param filterValue Value to match against
1731
- * @param map Callback or key to map the matched items
1732
- * @returns Filtered and mapped array of items
1581
+ * @param array Original array
1582
+ * @param callback Filter callback to match items
1583
+ * @returns New array with items dropped
1733
1584
  *
1734
1585
  * @example
1735
1586
  * ```typescript
1736
- * select(
1737
- * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
1738
- * item => item.id,
1739
- * 2,
1740
- * item => item.name,
1741
- * ); // => ['Bob']
1587
+ * drop(
1588
+ * [{id: 1}, {id: 2}, {id: 3}],
1589
+ * item => item.id === 2,
1590
+ * ); // => [{id: 2}, {id: 3}]
1742
1591
  * ```
1743
1592
  */
1744
- export declare function select<Item, FilterCallback extends (item: Item, index: number, array: Item[]) => unknown, Map extends MapKeyOrCallback<Item>>(array: Item[], filterCallback: FilterCallback, filterValue: ReturnType<FilterCallback>, map: Map): Array<Mapped<Item, Map>>;
1593
+ export declare function drop<Item extends PlainObject>(array: Item[], callback: (item: Item, index: number, array: Item[]) => boolean): Item[];
1745
1594
  /**
1746
- * Get a filtered and mapped array of items
1747
- *
1748
- * @param array Array to search in
1749
- * @param filterKey Key to get an item's value for matching
1750
- * @param filterValue Value to match against
1751
- * @param map Callback or key to map the matched items
1752
- * @returns Filtered and mapped array of items
1753
- *
1754
- * @example
1755
- * ```typescript
1756
- * select(
1757
- * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
1758
- * 'id',
1759
- * 2,
1760
- * 'name',
1761
- * ); // => ['Bob']
1762
- * ```
1763
- */
1764
- export declare function select<Item extends PlainObject, ItemKey extends keyof Item, Map extends MapKeyOrCallback<Item>>(array: Item[], filterKey: ItemKey, filterValue: Item[ItemKey], map: Map): Array<Mapped<Item, Map>>;
1765
- /**
1766
- * Get a filtered and mapped array of items
1767
- *
1768
- * @param array Array to search in
1769
- * @param filter Filter callback to match items
1770
- * @param map Callback or key to map the matched items
1771
- * @returns Filtered and mapped array of items
1772
- *
1773
- * @example
1774
- * ```typescript
1775
- * select(
1776
- * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
1777
- * item => item.id === 2,
1778
- * item => item.name,
1779
- * ); // => ['Bob']
1780
- * ```
1781
- */
1782
- export declare function select<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean, map: Map): Array<Mapped<Item, Map>>;
1783
- /**
1784
- * Get a filtered and mapped array of items
1785
- *
1786
- * @param array Array to search in
1787
- * @param item Item to match against
1788
- * @param map Callback or key to map the matched items
1789
- * @returns Filtered and mapped array of items
1790
- *
1791
- * @example
1792
- * ```typescript
1793
- * select(
1794
- * [1, 2, 3, 2, 1],
1795
- * 3,
1796
- * value => value ** 2,
1797
- * ); // => [9]
1798
- * ```
1799
- */
1800
- export declare function select<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], item: Item, map: Map): Array<Mapped<Item, Map>>;
1801
- export declare namespace select {
1802
- var reverse: typeof reverseSelect;
1803
- }
1804
- //#endregion
1805
- //#region src/array/single.d.ts
1806
- /**
1807
- * Get the _only_ item matching the given value
1808
- *
1809
- * Throws an error if multiple items match the value
1810
- *
1811
- * @param array Array to search in
1812
- * @param callback Callback to get an item's value for matching
1813
- * @param value Value to match against
1814
- * @returns Only item that matches the value, or `undefined` if no match is found
1815
- *
1816
- * @example
1817
- * ```typescript
1818
- * single(
1819
- * [{id: 1}, {id: 2}, {id: 3}],
1820
- * item => item.id,
1821
- * 2
1822
- * ); // => {id: 2}
1823
- * ```
1824
- */
1825
- export declare function single<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): Item | undefined;
1826
- /**
1827
- * Get the _only_ item matching the given value by key
1828
- *
1829
- * Throws an error if multiple items match the value
1830
- *
1831
- * @param array Array to search in
1832
- * @param key Key to get an item's value for matching
1833
- * @param value Value to match against
1834
- * @returns Only item that matches the value, or `undefined` if no match is found
1835
- *
1836
- * @example
1837
- * ```typescript
1838
- * single(
1839
- * [{id: 1}, {id: 2}, {id: 3}],
1840
- * 'id',
1841
- * 2
1842
- * ); // => {id: 2}
1843
- * ```
1844
- */
1845
- export declare function single<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item | undefined;
1846
- /**
1847
- * Get the _only_ item matching the filter
1848
- *
1849
- * Throws an error if multiple items match the filter
1850
- *
1851
- * @param array Array to search in
1852
- * @param filter Filter callback to match items
1853
- * @returns Only item that matches the filter, or `undefined` if no match is found
1854
- *
1855
- * @example
1856
- * ```typescript
1857
- * single(
1858
- * [{id: 1}, {id: 2}, {id: 3}],
1859
- * item => item.id === 2
1860
- * ); // => {id: 2}
1861
- * ```
1862
- */
1863
- export declare function single<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): Item | undefined;
1864
- //#endregion
1865
- //#region src/array/slice.d.ts
1866
- /**
1867
- * Drop items from the start of an array until they match a value
1868
- *
1869
- * @param array Original array
1870
- * @param callback Callback to get an item's value for matching
1871
- * @param value Value to match against
1872
- * @returns New array with items dropped
1873
- *
1874
- * @example
1875
- * ```typescript
1876
- * drop(
1877
- * [{id: 1}, {id: 2}, {id: 3}],
1878
- * item => item.id,
1879
- * 2,
1880
- * ); // => [{id: 2}, {id: 3}]
1881
- * ```
1882
- */
1883
- export declare function drop<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): Item[];
1884
- /**
1885
- * Drop items from the start of an array until they match a value
1886
- *
1887
- * @param array Original array
1888
- * @param key Key to get an item's value for matching
1889
- * @param value Value to match against
1890
- * @returns New array with items dropped
1891
- *
1892
- * @example
1893
- * ```typescript
1894
- * drop(
1895
- * [{id: 1}, {id: 2}, {id: 3}],
1896
- * 'id',
1897
- * 2,
1898
- * ); // => [{id: 2}, {id: 3}]
1899
- * ```
1900
- */
1901
- export declare function drop<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item[];
1902
- /**
1903
- * Drop items from the start of an array while they match a filter
1904
- *
1905
- * @param array Original array
1906
- * @param callback Filter callback to match items
1907
- * @returns New array with items dropped
1908
- *
1909
- * @example
1910
- * ```typescript
1911
- * drop(
1912
- * [{id: 1}, {id: 2}, {id: 3}],
1913
- * item => item.id === 2,
1914
- * ); // => [{id: 2}, {id: 3}]
1915
- * ```
1916
- */
1917
- export declare function drop<Item extends PlainObject>(array: Item[], callback: (item: Item, index: number, array: Item[]) => boolean): Item[];
1918
- /**
1919
- * Drop a specified number of items, from the start if `>= 0`, or from the end if `< 0`
1595
+ * Drop a specified number of items, from the start if `>= 0`, or from the end if `< 0`
1920
1596
  *
1921
1597
  * @param array Original array
1922
1598
  * @param count Number of items to drop
@@ -2448,10 +2124,6 @@ export declare function last<Item>(array: Item[], filter: (item: Item, index: nu
2448
2124
  * ```
2449
2125
  */
2450
2126
  export declare function last<Item>(array: Item[]): Item | undefined;
2451
- export declare namespace last {
2452
- var _a: typeof lastOrDefault;
2453
- export { _a as default };
2454
- }
2455
2127
  /**
2456
2128
  * Get the last item matching the given value
2457
2129
  *
@@ -2531,6 +2203,9 @@ export declare function lastOrDefault<Item>(array: Item[], defaultValue: Item, f
2531
2203
  * ```
2532
2204
  */
2533
2205
  export declare function lastOrDefault<Item>(array: Item[], defaultValue: Item): Item;
2206
+ export declare namespace last {
2207
+ export var defaulted: typeof lastOrDefault;
2208
+ }
2534
2209
  //#endregion
2535
2210
  //#region src/array/move.d.ts
2536
2211
  /**
@@ -2601,10 +2276,6 @@ export declare function move<Item extends PlainObject, ItemKey extends keyof Ite
2601
2276
  * ```
2602
2277
  */
2603
2278
  export declare function move<Item>(array: Item[], from: Item | Item[], to: Item | Item[]): Item[];
2604
- export declare namespace move {
2605
- var indices: typeof moveIndices;
2606
- var toIndex: typeof moveToIndex;
2607
- }
2608
2279
  /**
2609
2280
  * Move an item from one index to another within an array
2610
2281
  *
@@ -2695,46 +2366,240 @@ export declare function moveToIndex<Item extends PlainObject, ItemKey extends ke
2695
2366
  * ```
2696
2367
  */
2697
2368
  export declare function moveToIndex<Item>(array: Item[], value: Item | Item[], index: number): Item[];
2369
+ export declare namespace move {
2370
+ export var indices: typeof moveIndices;
2371
+ export var toIndex: typeof moveToIndex;
2372
+ }
2698
2373
  //#endregion
2699
- //#region src/array/sort.d.ts
2374
+ //#region src/array/select.d.ts
2375
+ type MapKeyOrCallback<Item> = ((item: Item, index: number, array: Item[]) => unknown) | (Item extends PlainObject ? keyof Item : never);
2376
+ type Mapped<Item, Map extends MapKeyOrCallback<Item>> = Map extends ((item: Item, index: number, array: Item[]) => unknown) ? ReturnType<Map> : Map extends keyof Item ? Item[Map] : never;
2377
+ type ObjectKeysOf<Item> = { [Key in keyof Item]: Item[Key] extends PlainObject ? Key : never; }[keyof Item];
2700
2378
  /**
2701
- * Sorting information for arrays _(using a comparison callback)_
2379
+ * Get a filtered and mapped array of items
2380
+ *
2381
+ * @param array Array to search in
2382
+ * @param filterCallback Callback to get an item's value for matching
2383
+ * @param filterValue Value to match against
2384
+ * @param map Callback or key to map the matched items
2385
+ * @returns Filtered and mapped array of items
2386
+ *
2387
+ * @example
2388
+ * ```typescript
2389
+ * select(
2390
+ * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
2391
+ * item => item.id,
2392
+ * 2,
2393
+ * item => item.name,
2394
+ * ); // => ['Bob']
2395
+ * ```
2702
2396
  */
2703
- export type ArrayComparisonSorter<Item> = {
2704
- /**
2705
- * Callback to use when comparing items and values
2706
- */
2707
- comparison: ComparisonSorter<Item>;
2708
- /**
2709
- * Direction to sort by
2710
- */
2711
- direction?: SortDirection;
2712
- };
2397
+ export declare function filterAndMap<Item, FilterCallback extends (item: Item, index: number, array: Item[]) => unknown, Map extends MapKeyOrCallback<Item>>(array: Item[], filterCallback: FilterCallback, filterValue: ReturnType<FilterCallback>, map: Map): Array<Mapped<Item, Map>>;
2713
2398
  /**
2714
- * Sorting information for arrays _(using a key)_
2399
+ * Get a filtered and mapped array of items
2400
+ *
2401
+ * @param array Array to search in
2402
+ * @param filterKey Key to get an item's value for matching
2403
+ * @param filterValue Value to match against
2404
+ * @param map Callback or key to map the matched items
2405
+ * @returns Filtered and mapped array of items
2406
+ *
2407
+ * @example
2408
+ * ```typescript
2409
+ * select(
2410
+ * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
2411
+ * 'id',
2412
+ * 2,
2413
+ * 'name',
2414
+ * ); // => ['Bob']
2415
+ * ```
2715
2416
  */
2716
- export type ArrayKeySorter<Item extends PlainObject, ItemKey extends keyof Item> = {
2717
- /**
2718
- * Comparator to use when comparing items and values
2719
- */
2720
- compare?: CompareCallback<Item, Item[ItemKey]>;
2721
- /**
2722
- * Direction to sort by
2723
- */
2724
- direction?: SortDirection;
2725
- /**
2726
- * Key to sort by
2727
- */
2728
- key: ItemKey;
2729
- };
2417
+ export declare function filterAndMap<Item extends PlainObject, ItemKey extends keyof Item, Map extends MapKeyOrCallback<Item>>(array: Item[], filterKey: ItemKey, filterValue: Item[ItemKey], map: Map): Array<Mapped<Item, Map>>;
2730
2418
  /**
2731
- * Sorters based on keys in an object
2419
+ * Get a filtered and mapped array of items
2420
+ *
2421
+ * @param array Array to search in
2422
+ * @param filter Filter callback to match items
2423
+ * @param map Callback or key to map the matched items
2424
+ * @returns Filtered and mapped array of items
2425
+ *
2426
+ * @example
2427
+ * ```typescript
2428
+ * select(
2429
+ * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
2430
+ * item => item.id === 2,
2431
+ * item => item.name,
2432
+ * ); // => ['Bob']
2433
+ * ```
2732
2434
  */
2733
- type ArrayKeySorters<Item extends PlainObject> = { [ItemKey in keyof Item]: ArrayKeySorter<Item, ItemKey>; }[keyof Item];
2435
+ export declare function filterAndMap<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean, map: Map): Array<Mapped<Item, Map>>;
2734
2436
  /**
2735
- * Sorter to use for sorting
2736
- */
2737
- export type ArraySorter<Item> = Item extends PlainObject ? keyof Item | ArrayComparisonSorter<Item> | ArrayKeySorters<Item> | ArrayValueSorter<Item> | ComparisonSorter<Item> : ArrayComparisonSorter<Item> | ArrayValueSorter<Item> | ComparisonSorter<Item>;
2437
+ * Get a filtered and mapped array of items
2438
+ *
2439
+ * @param array Array to search in
2440
+ * @param item Item to match against
2441
+ * @param map Callback or key to map the matched items
2442
+ * @returns Filtered and mapped array of items
2443
+ *
2444
+ * @example
2445
+ * ```typescript
2446
+ * select(
2447
+ * [1, 2, 3, 2, 1],
2448
+ * 3,
2449
+ * value => value ** 2,
2450
+ * ); // => [9]
2451
+ * ```
2452
+ */
2453
+ export declare function filterAndMap<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], item: Item, map: Map): Array<Mapped<Item, Map>>;
2454
+ /**
2455
+ * Get a mapped and filtered array of items
2456
+ *
2457
+ * _Available as `reverseSelect`_ and `select.reverse`_
2458
+ *
2459
+ * @param array Array to search in
2460
+ * @param map Callback or key to map the items
2461
+ * @param filterCallback Callback to get a mapped value's value for matching
2462
+ * @param filterValue Value to match against
2463
+ * @returns Mapped and filtered array of items
2464
+ *
2465
+ * @example
2466
+ * ```typescript
2467
+ * reverseSelect(
2468
+ * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
2469
+ * item => item.name,
2470
+ * value => value.length,
2471
+ * 3,
2472
+ * ); // => ['Bob']
2473
+ * ```
2474
+ */
2475
+ export declare function mapAndFilter<Item, Map extends MapKeyOrCallback<Item>, FilterCallback extends (item: Mapped<Item, Map>, index: number, array: Item[]) => unknown>(array: Item[], map: Map, filterCallback: FilterCallback, filterValue: ReturnType<FilterCallback>): Array<Mapped<Item, Map>>;
2476
+ /**
2477
+ * Get a mapped and filtered array of items
2478
+ *
2479
+ * _Available as `reverseSelect`_ and `select.reverse`_
2480
+ *
2481
+ * @param array Array to search in
2482
+ * @param map Callback to map the items
2483
+ * @param filterKey Key to get a mapped value's value for matching
2484
+ * @param filterValue Value to match against
2485
+ * @returns Mapped and filtered array of items
2486
+ *
2487
+ * @example
2488
+ * ```typescript
2489
+ * reverseSelect(
2490
+ * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
2491
+ * item => ({label: item.name}),
2492
+ * 'label',
2493
+ * 'Bob',
2494
+ * ); // => [{label: 'Bob'}]
2495
+ * ```
2496
+ */
2497
+ export declare function mapAndFilter<Item, MapCallback extends (item: Item, index: number, array: Item[]) => PlainObject, ItemKey extends keyof ReturnType<MapCallback>>(array: Item[], map: MapCallback, filterKey: ItemKey, filterValue: ReturnType<MapCallback>[ItemKey]): Array<ReturnType<MapCallback>>;
2498
+ /**
2499
+ * Get a mapped and filtered array of items
2500
+ *
2501
+ * _Available as `reverseSelect`_ and `select.reverse`_
2502
+ *
2503
+ * @param array Array to search in
2504
+ * @param map Key to map the items
2505
+ * @param filterKey Key to get a mapped value's value for matching
2506
+ * @param filterValue Value to match against
2507
+ * @returns Mapped and filtered array of items
2508
+ *
2509
+ * @example
2510
+ * ```typescript
2511
+ * reverseSelect(
2512
+ * [{meta: {tag: 'a'}}, {meta: {tag: 'b'}}],
2513
+ * 'meta',
2514
+ * 'tag',
2515
+ * 'b',
2516
+ * ); // => [{tag: 'b'}]
2517
+ * ```
2518
+ */
2519
+ export declare function mapAndFilter<Item, MapKey extends ObjectKeysOf<Item>, ItemKey extends keyof Item[MapKey]>(array: Item[], map: MapKey, filterKey: ItemKey, filterValue: Item[MapKey][ItemKey]): Array<Item[MapKey]>;
2520
+ /**
2521
+ * Get a mapped and filtered array of items
2522
+ *
2523
+ * _Available as `reverseSelect`_ and `select.reverse`_
2524
+ *
2525
+ * @param array Array to search in
2526
+ * @param map Callback or key to map the items
2527
+ * @param filter Filter callback to match mapped values
2528
+ * @returns Mapped and filtered array of items
2529
+ *
2530
+ * @example
2531
+ * ```typescript
2532
+ * reverseSelect(
2533
+ * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}],
2534
+ * item => item.name,
2535
+ * value => value.startsWith('B'),
2536
+ * ); // => ['Bob']
2537
+ * ```
2538
+ */
2539
+ export declare function mapAndFilter<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], map: Map, filter: (item: Mapped<Item, Map>, index: number, array: Item[]) => boolean): Array<Mapped<Item, Map>>;
2540
+ /**
2541
+ * Get a mapped and filtered array of items
2542
+ *
2543
+ * _Available as `reverseSelect`_ and `select.reverse`_
2544
+ *
2545
+ * @param array Array to search in
2546
+ * @param map Callback or key to map the items
2547
+ * @param value Mapped value to match against
2548
+ * @returns Mapped and filtered array of items
2549
+ *
2550
+ * @example
2551
+ * ```typescript
2552
+ * reverseSelect(
2553
+ * [1, 2, 3, 2, 1],
2554
+ * value => value ** 2,
2555
+ * 4,
2556
+ * ); // => [4, 4]
2557
+ * ```
2558
+ */
2559
+ export declare function mapAndFilter<Item, Map extends MapKeyOrCallback<Item>>(array: Item[], map: Map, value: Mapped<Item, Map>): Array<Mapped<Item, Map>>;
2560
+ export declare namespace filterAndMap {
2561
+ export var reverse: typeof mapAndFilter;
2562
+ }
2563
+ //#endregion
2564
+ //#region src/array/sort.d.ts
2565
+ /**
2566
+ * Sorting information for arrays _(using a comparison callback)_
2567
+ */
2568
+ export type ArrayComparisonSorter<Item> = {
2569
+ /**
2570
+ * Callback to use when comparing items and values
2571
+ */
2572
+ comparison: ComparisonSorter<Item>;
2573
+ /**
2574
+ * Direction to sort by
2575
+ */
2576
+ direction?: SortDirection;
2577
+ };
2578
+ /**
2579
+ * Sorting information for arrays _(using a key)_
2580
+ */
2581
+ export type ArrayKeySorter<Item extends PlainObject, ItemKey extends keyof Item> = {
2582
+ /**
2583
+ * Comparator to use when comparing items and values
2584
+ */
2585
+ compare?: CompareCallback<Item, Item[ItemKey]>;
2586
+ /**
2587
+ * Direction to sort by
2588
+ */
2589
+ direction?: SortDirection;
2590
+ /**
2591
+ * Key to sort by
2592
+ */
2593
+ key: ItemKey;
2594
+ };
2595
+ /**
2596
+ * Sorters based on keys in an object
2597
+ */
2598
+ type ArrayKeySorters<Item extends PlainObject> = { [ItemKey in keyof Item]: ArrayKeySorter<Item, ItemKey>; }[keyof Item];
2599
+ /**
2600
+ * Sorter to use for sorting
2601
+ */
2602
+ export type ArraySorter<Item> = Item extends PlainObject ? keyof Item | ArrayComparisonSorter<Item> | ArrayKeySorters<Item> | ArrayValueSorter<Item> | ComparisonSorter<Item> : ArrayComparisonSorter<Item> | ArrayValueSorter<Item> | ComparisonSorter<Item>;
2738
2603
  /**
2739
2604
  * Sorters to use for sorting
2740
2605
  */
@@ -2764,7 +2629,7 @@ type ComparisonSorter<Item> = (first: Item, second: Item) => number;
2764
2629
  /**
2765
2630
  * Direction to sort by
2766
2631
  */
2767
- export type SortDirection = 'ascending' | 'descending';
2632
+ export type SortDirection = "ascending" | "descending";
2768
2633
  /**
2769
2634
  * Sorter for an array with predefined sorters
2770
2635
  *
@@ -2941,13 +2806,13 @@ export declare function sort<Item>(array: Item[], sorter: ArraySorter<Item>, des
2941
2806
  * @returns Sorted array
2942
2807
  */
2943
2808
  export declare function sort<Item>(array: Item[], descending?: boolean): Item[];
2944
- export declare namespace sort {
2945
- var getIndex: typeof getSortedIndex;
2946
- var initialize: typeof initializeSorter;
2947
- var is: typeof isSorted;
2948
- }
2949
2809
  export declare const SORT_DIRECTION_ASCENDING: SortDirection;
2950
2810
  export declare const SORT_DIRECTION_DESCENDING: SortDirection;
2811
+ export declare namespace sort {
2812
+ export var getIndex: typeof getSortedIndex;
2813
+ export var initialize: typeof initializeSorter;
2814
+ export var is: typeof isSorted;
2815
+ }
2951
2816
  //#endregion
2952
2817
  //#region src/array/swap.d.ts
2953
2818
  /**
@@ -3116,9 +2981,6 @@ export declare function swap<Item extends PlainObject, ItemKey extends keyof Ite
3116
2981
  * ```
3117
2982
  */
3118
2983
  export declare function swap<Item>(array: Item[], first: Item, second: Item): Item[];
3119
- export declare namespace swap {
3120
- var indices: typeof swapIndices;
3121
- }
3122
2984
  /**
3123
2985
  * Swap two indiced items in an array
3124
2986
  *
@@ -3132,6 +2994,9 @@ export declare namespace swap {
3132
2994
  * @returns Original array with items swapped _(or unchanged if unable to swap)_
3133
2995
  */
3134
2996
  declare function swapIndices<Item>(array: Item[], first: number, second: number): Item[];
2997
+ export declare namespace swap {
2998
+ export var indices: typeof swapIndices;
2999
+ }
3135
3000
  //#endregion
3136
3001
  //#region src/array/to-map.d.ts
3137
3002
  /**
@@ -3186,9 +3051,6 @@ export declare function toMap<Item, KeyArg extends KeyOrCallback<Item, Key$1>>(a
3186
3051
  * ```
3187
3052
  */
3188
3053
  export declare function toMap<Item>(array: Item[]): Map<number, Item>;
3189
- export declare namespace toMap {
3190
- var arrays: typeof toMapArrays;
3191
- }
3192
3054
  /**
3193
3055
  * Create a _Map_ from an array of items using a specific key, grouping values into arrays
3194
3056
  *
@@ -3227,6 +3089,9 @@ export declare function toMapArrays<Item, KeyArg extends KeyOrCallback<Item, Key
3227
3089
  * ```
3228
3090
  */
3229
3091
  export declare function toMapArrays<Item, KeyArg extends KeyOrCallback<Item, Key$1>>(array: Item[], key: KeyArg): Map<KeyOrCallbackKey<Item, KeyArg>, Item[]>;
3092
+ export declare namespace toMap {
3093
+ export var arrays: typeof toMapArrays;
3094
+ }
3230
3095
  //#endregion
3231
3096
  //#region src/array/to-record.d.ts
3232
3097
  /**
@@ -3281,9 +3146,6 @@ export declare function toRecord<Item, KeyArg extends KeyOrCallback<Item, Key$1>
3281
3146
  * ```
3282
3147
  */
3283
3148
  export declare function toRecord<Item>(array: Item[]): Record<number, Item>;
3284
- export declare namespace toRecord {
3285
- var arrays: typeof toRecordArrays;
3286
- }
3287
3149
  /**
3288
3150
  * Create a record from an array of items using a specific key, grouping values into arrays
3289
3151
  *
@@ -3322,6 +3184,9 @@ export declare function toRecordArrays<Item, KeyArg extends KeyOrCallback<Item,
3322
3184
  * ```
3323
3185
  */
3324
3186
  export declare function toRecordArrays<Item, KeyArg extends KeyOrCallback<Item, Key$1>>(array: Item[], key: KeyArg): Simplify<Record<KeyOrCallbackKey<Item, KeyArg>, Item[]>>;
3187
+ export declare namespace toRecord {
3188
+ export var arrays: typeof toRecordArrays;
3189
+ }
3325
3190
  //#endregion
3326
3191
  //#region src/internal/function/misc.d.ts
3327
3192
  /**
@@ -3400,9 +3265,6 @@ export declare function asyncThrottle<Callback extends GenericAsyncCallback | Ge
3400
3265
  * @returns Debounced callback handler with a `cancel` method
3401
3266
  */
3402
3267
  export declare function debounce<Callback extends GenericCallback>(callback: Callback, time?: number): Limiter<Callback>;
3403
- export declare namespace debounce {
3404
- var async: typeof asyncDebounce;
3405
- }
3406
3268
  /**
3407
3269
  * Throttle a function, ensuring it is only called once every `time` milliseconds
3408
3270
  *
@@ -3411,13 +3273,14 @@ export declare namespace debounce {
3411
3273
  * @returns Throttled callback handler with a `cancel` method
3412
3274
  */
3413
3275
  export declare function throttle<Callback extends GenericCallback>(callback: Callback, time?: number): Limiter<Callback>;
3276
+ export declare namespace debounce {
3277
+ export var async: typeof asyncDebounce;
3278
+ }
3414
3279
  export declare namespace throttle {
3415
- var async: typeof asyncThrottle;
3280
+ export var async: typeof asyncThrottle;
3416
3281
  }
3417
3282
  //#endregion
3418
3283
  //#region src/function/once.d.ts
3419
- declare function OnceAsync(this: any, callback: GenericAsyncCallback): void;
3420
- declare function Once(this: any, callback: GenericCallback): void;
3421
3284
  /**
3422
3285
  * Create an asynchronous function that can only be called once, rejecting or resolving the same result on subsequent calls
3423
3286
  *
@@ -3427,9 +3290,6 @@ declare function Once(this: any, callback: GenericCallback): void;
3427
3290
  * @returns _Once_ callback
3428
3291
  */
3429
3292
  export declare function asyncOnce<Callback extends GenericAsyncCallback>(callback: Callback): OnceAsync<Callback>;
3430
- export declare namespace asyncOnce {
3431
- var is: typeof isAsyncOnce;
3432
- }
3433
3293
  /**
3434
3294
  * Is the value an asynchronous once callback?
3435
3295
  *
@@ -3451,10 +3311,13 @@ export declare function isOnce(value: unknown): boolean;
3451
3311
  * @returns _Once_ callback
3452
3312
  */
3453
3313
  export declare function once<Callback extends GenericCallback>(callback: Callback): Once<Callback>;
3314
+ export declare namespace asyncOnce {
3315
+ export var is: typeof isAsyncOnce;
3316
+ }
3454
3317
  export declare namespace once {
3455
- var async: typeof asyncOnce;
3456
- var is: typeof isOnce;
3457
- var isAsync: typeof isAsyncOnce;
3318
+ export var async: typeof asyncOnce;
3319
+ export var is: typeof isOnce;
3320
+ export var isAsync: typeof isAsyncOnce;
3458
3321
  }
3459
3322
  //#endregion
3460
3323
  //#region src/function/retry.d.ts
@@ -3471,36 +3334,338 @@ export type RetryOptions = {
3471
3334
  when?: (error: unknown) => boolean;
3472
3335
  };
3473
3336
  /**
3474
- * Retry a callback a specified number of times, with a delay between attempts
3475
- *
3476
- * _Available as `asyncRetry` and `retry.async`_
3477
- *
3478
- * @param callback Callback to retry
3479
- * @param options Retry options
3480
- * @returns Callback result
3481
- */
3482
- declare function asyncRetry<Callback extends GenericAsyncCallback>(callback: Callback, options?: RetryOptions): Promise<Awaited<ReturnType<Callback>>>;
3483
- /**
3484
- * Retry a callback a specified number of times, with a delay between attempts
3485
- *
3486
- * _Available as `asyncRetry` and `retry.async`_
3487
- *
3488
- * @param callback Callback to retry
3489
- * @param options Retry options
3490
- * @returns Callback result
3337
+ * Retry a callback a specified number of times, with a delay between attempts
3338
+ *
3339
+ * _Available as `asyncRetry` and `retry.async`_
3340
+ *
3341
+ * @param callback Callback to retry
3342
+ * @param options Retry options
3343
+ * @returns Callback result
3344
+ */
3345
+ declare function asyncRetry<Callback extends GenericAsyncCallback>(callback: Callback, options?: RetryOptions): Promise<Awaited<ReturnType<Callback>>>;
3346
+ /**
3347
+ * Retry a callback a specified number of times, with a delay between attempts
3348
+ *
3349
+ * _Available as `asyncRetry` and `retry.async`_
3350
+ *
3351
+ * @param callback Callback to retry
3352
+ * @param options Retry options
3353
+ * @returns Callback result
3354
+ */
3355
+ declare function asyncRetry<Callback extends GenericCallback>(callback: Callback, options?: RetryOptions): Promise<ReturnType<Callback>>;
3356
+ /**
3357
+ * Retry a callback a specified number of times
3358
+ *
3359
+ * @param callback Callback to retry
3360
+ * @param options Retry options
3361
+ * @returns Callback result
3362
+ */
3363
+ export declare function retry<Callback extends GenericCallback>(callback: Callback, options?: Omit<RetryOptions, "delay">): ReturnType<Callback>;
3364
+ export declare namespace retry {
3365
+ export var async: typeof asyncRetry;
3366
+ }
3367
+ //#endregion
3368
+ //#region src/internal/array/index-of.d.ts
3369
+ /**
3370
+ * Get the index of the first matching item by callback
3371
+ *
3372
+ * @param array Array to search in
3373
+ * @param callback Callback to get an item's value
3374
+ * @param value Value to match against
3375
+ * @returns Index of the first matching item, or `-1` if no match is found
3376
+ *
3377
+ * @example
3378
+ * ```typescript
3379
+ * indexOf(
3380
+ * [{id: 1}, {id: 2}, {id: 3}],
3381
+ * item => item.id,
3382
+ * 2,
3383
+ * ); // => 1
3384
+ * ```
3385
+ */
3386
+ export declare function indexOf<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): number;
3387
+ /**
3388
+ * Get the index of the first matching item by key
3389
+ *
3390
+ * @param array Array to search in
3391
+ * @param key Key to match items by
3392
+ * @param value Value to match against
3393
+ * @returns Index of the first matching item, or `-1` if no match is found
3394
+ *
3395
+ * @example
3396
+ * ```typescript
3397
+ * indexOf(
3398
+ * [{id: 1}, {id: 2}, {id: 3}],
3399
+ * 'id',
3400
+ * 2,
3401
+ * ); // => 1
3402
+ * ```
3403
+ */
3404
+ export declare function indexOf<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): number;
3405
+ /**
3406
+ * Get the index of the first item matching the filter
3407
+ *
3408
+ * @param array Array to search in
3409
+ * @param filter Filter callback to match items
3410
+ * @returns Index of the first matching item, or `-1` if no match is found
3411
+ *
3412
+ * @example
3413
+ * ```typescript
3414
+ * indexOf(
3415
+ * [{id: 1}, {id: 2}, {id: 3}],
3416
+ * item => item.id === 2,
3417
+ * ); // => 1
3418
+ * ```
3419
+ */
3420
+ export declare function indexOf<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): number;
3421
+ /**
3422
+ * Get the index of the first item matching the given item
3423
+ *
3424
+ * @param array Array to search in
3425
+ * @param item Item to match against
3426
+ * @returns Index of the first matching item, or `-1` if no match is found
3427
+ *
3428
+ * @example
3429
+ * ```typescript
3430
+ * indexOf([1, 2, 3, 4, 5], 3); // => 2
3431
+ * ```
3432
+ */
3433
+ export declare function indexOf<Item>(array: Item[], item: Item): number;
3434
+ /**
3435
+ * Get the index of the last matching item by callback
3436
+ *
3437
+ * _Available as `lastIndexOf` and `indexOf.last`_
3438
+ *
3439
+ * @param array Array to search in
3440
+ * @param callback Callback to get an item's value
3441
+ * @param value Value to match against
3442
+ * @returns Index of the last matching item, or `-1` if no match is found
3443
+ *
3444
+ * @example
3445
+ * ```typescript
3446
+ * lastIndexOf(
3447
+ * [{id: 1}, {id: 2}, {id: 3}, {id: 2}],
3448
+ * item => item.id,
3449
+ * 2,
3450
+ * ); // => 3
3451
+ * ```
3452
+ */
3453
+ export declare function lastIndexOf<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): number;
3454
+ /**
3455
+ * Get the index of the last matching item by key
3456
+ *
3457
+ * _Available as `lastIndexOf` and `indexOf.last`_
3458
+ *
3459
+ * @param array Array to search in
3460
+ * @param key Key to match items by
3461
+ * @param value Value to match against
3462
+ * @returns Index of the last matching item, or `-1` if no match is found
3463
+ *
3464
+ * @example
3465
+ * ```typescript
3466
+ * lastIndexOf(
3467
+ * [{id: 1}, {id: 2}, {id: 3}, {id: 2}],
3468
+ * 'id',
3469
+ * 2,
3470
+ * ); // => 3
3471
+ * ```
3472
+ */
3473
+ export declare function lastIndexOf<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): number;
3474
+ /**
3475
+ * Get the index of the last item matching the filter
3476
+ *
3477
+ * _Available as `lastIndexOf` and `indexOf.last`_
3478
+ *
3479
+ * @param array Array to search in
3480
+ * @param filter Filter callback to match items
3481
+ * @returns Index of the last matching item, or `-1` if no match is found
3482
+ *
3483
+ * @example
3484
+ * ```typescript
3485
+ * lastIndexOf(
3486
+ * [{id: 1}, {id: 2}, {id: 3}, {id: 2}],
3487
+ * item => item.id === 2,
3488
+ * ); // => 3
3489
+ * ```
3490
+ */
3491
+ export declare function lastIndexOf<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): number;
3492
+ /**
3493
+ * Get the index of the last item matching the given item
3494
+ *
3495
+ * _Available as `lastIndexOf` and `indexOf.last`_
3496
+ *
3497
+ * @param array Array to search in
3498
+ * @param item Item to match against
3499
+ * @returns Index of the last matching item, or `-1` if no match is found
3500
+ *
3501
+ * @example
3502
+ * ```typescript
3503
+ * lastIndexOf([1, 2, 3, 2, 1], 2); // => 3
3504
+ * ```
3505
+ */
3506
+ export declare function lastIndexOf<Item>(array: Item[], item: Item): number;
3507
+ export declare namespace indexOf {
3508
+ export var last: typeof lastIndexOf;
3509
+ }
3510
+ //#endregion
3511
+ //#region src/internal/function/assert.d.ts
3512
+ /**
3513
+ * Asserter for a property of a value
3514
+ */
3515
+ export type AssertProperty<Value extends PlainObject, Path extends NestedKeys<Value>, Asserted extends NestedPick<Value, Path> = NestedPick<Value, Path>> = Asserter<Asserted>;
3516
+ /**
3517
+ * A function that asserts a value is of a specific type, throwing an error if it is not
3518
+ */
3519
+ export type Asserter<Value> = (value: unknown) => asserts value is Value;
3520
+ type NestedPick<Value, Path extends string> = Value extends PlainObject ? Path extends `${infer Head}.${infer Rest}` ? Head extends keyof Value ? { [Key in Head]: NestedPick<Value[Key], Rest>; } : never : Path extends keyof Value ? { [Key in Path]: Value[Key]; } : never : never;
3521
+ /**
3522
+ * Asserts that a condition is true, throwing an error if it is not
3523
+ *
3524
+ * @param condition Condition to assert
3525
+ * @param message Error message
3526
+ * @param error Error constructor _(defaults to `Error`)_
3527
+ */
3528
+ export declare function assert<Condition extends () => boolean>(condition: Condition, message: string, error?: ErrorConstructor): asserts condition;
3529
+ /**
3530
+ * Creates an _Asserter_ that asserts a condition is true, throwing an error if it is not
3531
+ *
3532
+ * _Available as `assertCondition` and `assert.condition`_
3533
+ *
3534
+ * @param condition Condition to assert
3535
+ * @param message Error message
3536
+ * @param error Error constructor _(defaults to `Error`)_
3537
+ * @returns _Asserter_
3538
+ */
3539
+ export declare function assertCondition<Value>(condition: (value: unknown) => boolean, message: string, error?: ErrorConstructor): Asserter<Value>;
3540
+ /**
3541
+ * Asserts that a value is defined, throwing an error if it is not
3542
+ *
3543
+ * _Available as `assertDefined` and `assert.defined`_
3544
+ *
3545
+ * @param value Value to assert
3546
+ * @param message Error message
3547
+ * @param error Error constructor _(defaults to `Error`)_
3548
+ */
3549
+ export declare function assertDefined<Value>(value: unknown, message?: string, error?: ErrorConstructor): asserts value is Exclude<Value, null | undefined>;
3550
+ /**
3551
+ * Creates an _Asserter_ that asserts a value is an instance of a constructor, throwing an error if it is not
3552
+ *
3553
+ * _Available as `assertInstanceOf` and `assert.instanceOf`_
3554
+ *
3555
+ * @param constructor Constructor to check against
3556
+ * @param message Error message
3557
+ * @param error Error constructor _(defaults to `Error`)_
3558
+ * @returns _Asserter_
3559
+ */
3560
+ export declare function assertInstanceOf<Value>(constructor: Constructor<Value>, message: string, error?: ErrorConstructor): Asserter<Value>;
3561
+ /**
3562
+ * Creates an _Asserter_ that asserts a value is of a specific type, throwing an error if it is not
3563
+ *
3564
+ * _Available as `assertIs` and `assert.is`_
3565
+ *
3566
+ * @param condition Type guard function to check the value
3567
+ * @param message Error message
3568
+ * @param error Error constructor _(defaults to `Error`)_
3569
+ * @returns _Asserter_
3570
+ */
3571
+ export declare function assertIs<Value>(condition: (value: unknown) => value is Value, message: string, error?: ErrorConstructor): Asserter<Value>;
3572
+ /**
3573
+ * Creates an _Asserter_ that asserts a property of a value exists and satisfies a condition, throwing an error if it does not
3574
+ *
3575
+ * _Available as `assertProperty` and `assert.property`_
3576
+ *
3577
+ * @param path Path to the property to check, e.g., `foo.bar.baz` for a nested property
3578
+ * @param condition Condition to assert for the property
3579
+ * @param message Error message
3580
+ * @param error Error constructor _(defaults to `Error`)_
3581
+ * @returns _Asserter_
3582
+ */
3583
+ export declare function assertProperty<Value extends PlainObject, Path extends NestedKeys<Value>>(path: Path, condition: (value: NestedValue<Value, Path>) => boolean, message: string, error?: ErrorConstructor): Asserter<NestedPick<Value, Path>>;
3584
+ export declare namespace assert {
3585
+ export var condition: typeof assertCondition;
3586
+ export var defined: typeof assertDefined;
3587
+ export var instanceOf: typeof assertInstanceOf;
3588
+ export var is: typeof assertIs;
3589
+ export var property: typeof assertProperty;
3590
+ }
3591
+ //#endregion
3592
+ //#region src/internal/function/memoize.d.ts
3593
+ /**
3594
+ * A _Memoized_ function instance, caching and retrieving results based on the its parameters _(or a custom cache key)_
3595
+ */
3596
+ export type Memoized<Callback extends GenericCallback> = {
3597
+ /**
3598
+ * Maximum cache size
3599
+ *
3600
+ * @returns Maximum cache size _(or `Number.NaN` if the instance has been destroyed)_
3601
+ */
3602
+ get maximum(): number;
3603
+ /**
3604
+ * Current cache size
3605
+ *
3606
+ * @returns Current cache size _(or `Number.NaN` if the instance has been destroyed)_
3607
+ */
3608
+ get size(): number;
3609
+ /**
3610
+ * Clear the cache
3611
+ */
3612
+ clear(): void;
3613
+ /**
3614
+ * Delete a result from the cache
3615
+ *
3616
+ * @param key Key to delete
3617
+ * @returns `true` if the key existed and was removed, otherwise `false`
3618
+ */
3619
+ delete(key: unknown): boolean;
3620
+ /**
3621
+ * Destroy the instance
3622
+ *
3623
+ * _(When a Memoized instance is destroyed, its cache and callback are removed, and calls to `run` will throw an error)_
3624
+ */
3625
+ destroy(): void;
3626
+ /**
3627
+ * Get a result from the cache
3628
+ *
3629
+ * @param key Key to get
3630
+ * @returns Cached result or `undefined` if it does not exist
3631
+ */
3632
+ get(key: unknown): ReturnType<Callback> | undefined;
3633
+ /**
3634
+ * Does the result exist?
3635
+ *
3636
+ * @param key Key to check
3637
+ * @returns `true` if the result exists, otherwise `false`
3638
+ */
3639
+ has(key: unknown): boolean;
3640
+ /**
3641
+ * Run the callback with the provided parameters
3642
+ *
3643
+ * @param parameters Parameters to pass to the callback
3644
+ * @returns Cached or computed _(then cached)_ result
3645
+ */
3646
+ run(...parameters: Parameters<Callback>): ReturnType<Callback>;
3647
+ };
3648
+ /**
3649
+ * Options for a _Memoized_ function
3491
3650
  */
3492
- declare function asyncRetry<Callback extends GenericCallback>(callback: Callback, options?: RetryOptions): Promise<ReturnType<Callback>>;
3651
+ export type MemoizedOptions<Callback extends GenericCallback> = {
3652
+ /**
3653
+ * Callback for getting a cache key for the provided parameters
3654
+ */
3655
+ cacheKey?: (...parameters: Parameters<Callback>) => unknown;
3656
+ /**
3657
+ * Size of the cache
3658
+ */
3659
+ cacheSize?: number;
3660
+ };
3493
3661
  /**
3494
- * Retry a callback a specified number of times
3662
+ * Memoize a function, caching and retrieving results based on the first parameter
3495
3663
  *
3496
- * @param callback Callback to retry
3497
- * @param options Retry options
3498
- * @returns Callback result
3664
+ * @param callback Callback to memoize
3665
+ * @param options Memoization options
3666
+ * @returns _Memoized_ instance
3499
3667
  */
3500
- export declare function retry<Callback extends GenericCallback>(callback: Callback, options?: Omit<RetryOptions, 'delay'>): ReturnType<Callback>;
3501
- export declare namespace retry {
3502
- var async: typeof asyncRetry;
3503
- }
3668
+ export declare function memoize<Callback extends GenericCallback>(callback: Callback, options?: MemoizedOptions<Callback>): Memoized<Callback>;
3504
3669
  //#endregion
3505
3670
  //#region src/internal/result/models.d.ts
3506
3671
  /**
@@ -3741,9 +3906,6 @@ export declare function flow<First extends GenericCallback>(first: First, ...fns
3741
3906
  * @returns _Flow_ function
3742
3907
  */
3743
3908
  export declare function flow(...fns: GenericCallback[]): (...args: unknown[]) => unknown;
3744
- export declare namespace flow {
3745
- var async: typeof asyncFlow;
3746
- }
3747
3909
  /**
3748
3910
  * Pipe a value through a function
3749
3911
  *
@@ -3936,168 +4098,12 @@ export declare function pipe<Value>(value: Value, ...pipes: Array<(value: Value)
3936
4098
  * @returns _Piped_ result
3937
4099
  */
3938
4100
  export declare function pipe(value: unknown, ...pipes: Array<(value: unknown) => unknown>): unknown;
3939
- export declare namespace pipe {
3940
- var async: typeof asyncPipe;
4101
+ export declare namespace flow {
4102
+ export var async: typeof asyncFlow;
3941
4103
  }
3942
- //#endregion
3943
- //#region src/internal/function/assert.d.ts
3944
- /**
3945
- * Asserter for a property of a value
3946
- */
3947
- export type AssertProperty<Value extends PlainObject, Path extends NestedKeys<Value>, Asserted extends NestedPick<Value, Path> = NestedPick<Value, Path>> = Asserter<Asserted>;
3948
- /**
3949
- * A function that asserts a value is of a specific type, throwing an error if it is not
3950
- */
3951
- export type Asserter<Value> = (value: unknown) => asserts value is Value;
3952
- type NestedPick<Value, Path extends string> = Value extends PlainObject ? Path extends `${infer Head}.${infer Rest}` ? Head extends keyof Value ? { [Key in Head]: NestedPick<Value[Key], Rest>; } : never : Path extends keyof Value ? { [Key in Path]: Value[Key]; } : never : never;
3953
- /**
3954
- * Asserts that a condition is true, throwing an error if it is not
3955
- *
3956
- * @param condition Condition to assert
3957
- * @param message Error message
3958
- * @param error Error constructor _(defaults to `Error`)_
3959
- */
3960
- export declare function assert<Condition extends () => boolean>(condition: Condition, message: string, error?: ErrorConstructor): asserts condition;
3961
- export declare namespace assert {
3962
- var condition: typeof assertCondition;
3963
- var defined: typeof assertDefined;
3964
- var instanceOf: typeof assertInstanceOf;
3965
- var is: typeof assertIs;
3966
- var property: typeof assertProperty;
4104
+ export declare namespace pipe {
4105
+ export var async: typeof asyncPipe;
3967
4106
  }
3968
- /**
3969
- * Creates an _Asserter_ that asserts a condition is true, throwing an error if it is not
3970
- *
3971
- * _Available as `assertCondition` and `assert.condition`_
3972
- *
3973
- * @param condition Condition to assert
3974
- * @param message Error message
3975
- * @param error Error constructor _(defaults to `Error`)_
3976
- * @returns _Asserter_
3977
- */
3978
- export declare function assertCondition<Value>(condition: (value: unknown) => boolean, message: string, error?: ErrorConstructor): Asserter<Value>;
3979
- /**
3980
- * Asserts that a value is defined, throwing an error if it is not
3981
- *
3982
- * _Available as `assertDefined` and `assert.defined`_
3983
- *
3984
- * @param value Value to assert
3985
- * @param message Error message
3986
- * @param error Error constructor _(defaults to `Error`)_
3987
- */
3988
- export declare function assertDefined<Value>(value: unknown, message?: string, error?: ErrorConstructor): asserts value is Exclude<Value, null | undefined>;
3989
- /**
3990
- * Creates an _Asserter_ that asserts a value is an instance of a constructor, throwing an error if it is not
3991
- *
3992
- * _Available as `assertInstanceOf` and `assert.instanceOf`_
3993
- *
3994
- * @param constructor Constructor to check against
3995
- * @param message Error message
3996
- * @param error Error constructor _(defaults to `Error`)_
3997
- * @returns _Asserter_
3998
- */
3999
- export declare function assertInstanceOf<Value>(constructor: Constructor<Value>, message: string, error?: ErrorConstructor): Asserter<Value>;
4000
- /**
4001
- * Creates an _Asserter_ that asserts a value is of a specific type, throwing an error if it is not
4002
- *
4003
- * _Available as `assertIs` and `assert.is`_
4004
- *
4005
- * @param condition Type guard function to check the value
4006
- * @param message Error message
4007
- * @param error Error constructor _(defaults to `Error`)_
4008
- * @returns _Asserter_
4009
- */
4010
- export declare function assertIs<Value>(condition: (value: unknown) => value is Value, message: string, error?: ErrorConstructor): Asserter<Value>;
4011
- /**
4012
- * Creates an _Asserter_ that asserts a property of a value exists and satisfies a condition, throwing an error if it does not
4013
- *
4014
- * _Available as `assertProperty` and `assert.property`_
4015
- *
4016
- * @param path Path to the property to check, e.g., `foo.bar.baz` for a nested property
4017
- * @param condition Condition to assert for the property
4018
- * @param message Error message
4019
- * @param error Error constructor _(defaults to `Error`)_
4020
- * @returns _Asserter_
4021
- */
4022
- export declare function assertProperty<Value extends PlainObject, Path extends NestedKeys<Value>>(path: Path, condition: (value: NestedValue<Value, Path>) => boolean, message: string, error?: ErrorConstructor): Asserter<NestedPick<Value, Path>>;
4023
- //#endregion
4024
- //#region src/internal/function/memoize.d.ts
4025
- /**
4026
- * A _Memoized_ function instance, caching and retrieving results based on the its parameters _(or a custom cache key)_
4027
- */
4028
- export type Memoized<Callback extends GenericCallback> = {
4029
- /**
4030
- * Maximum cache size
4031
- *
4032
- * @returns Maximum cache size _(or `Number.NaN` if the instance has been destroyed)_
4033
- */
4034
- get maximum(): number;
4035
- /**
4036
- * Current cache size
4037
- *
4038
- * @returns Current cache size _(or `Number.NaN` if the instance has been destroyed)_
4039
- */
4040
- get size(): number;
4041
- /**
4042
- * Clear the cache
4043
- */
4044
- clear(): void;
4045
- /**
4046
- * Delete a result from the cache
4047
- *
4048
- * @param key Key to delete
4049
- * @returns `true` if the key existed and was removed, otherwise `false`
4050
- */
4051
- delete(key: unknown): boolean;
4052
- /**
4053
- * Destroy the instance
4054
- *
4055
- * _(When a Memoized instance is destroyed, its cache and callback are removed, and calls to `run` will throw an error)_
4056
- */
4057
- destroy(): void;
4058
- /**
4059
- * Get a result from the cache
4060
- *
4061
- * @param key Key to get
4062
- * @returns Cached result or `undefined` if it does not exist
4063
- */
4064
- get(key: unknown): ReturnType<Callback> | undefined;
4065
- /**
4066
- * Does the result exist?
4067
- *
4068
- * @param key Key to check
4069
- * @returns `true` if the result exists, otherwise `false`
4070
- */
4071
- has(key: unknown): boolean;
4072
- /**
4073
- * Run the callback with the provided parameters
4074
- *
4075
- * @param parameters Parameters to pass to the callback
4076
- * @returns Cached or computed _(then cached)_ result
4077
- */
4078
- run(...parameters: Parameters<Callback>): ReturnType<Callback>;
4079
- };
4080
- /**
4081
- * Options for a _Memoized_ function
4082
- */
4083
- export type MemoizedOptions<Callback extends GenericCallback> = {
4084
- /**
4085
- * Callback for getting a cache key for the provided parameters
4086
- */
4087
- cacheKey?: (...parameters: Parameters<Callback>) => unknown;
4088
- /**
4089
- * Size of the cache
4090
- */
4091
- cacheSize?: number;
4092
- };
4093
- /**
4094
- * Memoize a function, caching and retrieving results based on the first parameter
4095
- *
4096
- * @param callback Callback to memoize
4097
- * @param options Memoization options
4098
- * @returns _Memoized_ instance
4099
- */
4100
- export declare function memoize<Callback extends GenericCallback>(callback: Callback, options?: MemoizedOptions<Callback>): Memoized<Callback>;
4101
4107
  //#endregion
4102
4108
  //#region src/internal/sized/map.d.ts
4103
4109
  /**
@@ -4140,11 +4146,11 @@ export declare class SizedMap<SizedKey = unknown, SizedValue = unknown> extends
4140
4146
  /**
4141
4147
  * @inheritdoc
4142
4148
  */
4143
- get(key: SizedKey): SizedValue | undefined;
4149
+ override get(key: SizedKey): SizedValue | undefined;
4144
4150
  /**
4145
4151
  * @inheritdoc
4146
4152
  */
4147
- set(key: SizedKey, value: SizedValue): this;
4153
+ override set(key: SizedKey, value: SizedValue): this;
4148
4154
  }
4149
4155
  //#endregion
4150
4156
  //#region src/internal/string/case.d.ts
@@ -4246,6 +4252,28 @@ export declare function tryEncode(value: boolean | number | string): unknown;
4246
4252
  */
4247
4253
  export declare function words(value: string): string[];
4248
4254
  //#endregion
4255
+ //#region src/internal/value/handlers.d.ts
4256
+ type BaseHandler = {
4257
+ handlers: WeakMap<WeakKey, string | GenericCallback>;
4258
+ options: BaseHandlerOptions;
4259
+ owner: GenericCallback;
4260
+ deregister: (constructor: Constructor) => void;
4261
+ get: (first: unknown, second: unknown) => string | GenericCallback | undefined;
4262
+ register: (constructor: Constructor, handler?: string | GenericCallback) => void;
4263
+ };
4264
+ type BaseHandlerOptions = {
4265
+ callback: GenericCallback;
4266
+ method?: string;
4267
+ };
4268
+ type CompareHandler<Value> = {
4269
+ base: BaseHandler;
4270
+ handle(first: unknown, second: unknown, ...parameters: unknown[]): Value;
4271
+ };
4272
+ type ValueHandler = {
4273
+ base: BaseHandler;
4274
+ handle(value: unknown, ...parameters: unknown[]): unknown;
4275
+ };
4276
+ //#endregion
4249
4277
  //#region src/internal/value/compare.d.ts
4250
4278
  type Comparator<Value = any> = (first: Value, second: Value) => number;
4251
4279
  /**
@@ -4256,24 +4284,6 @@ type Comparator<Value = any> = (first: Value, second: Value) => number;
4256
4284
  * @returns `0` if equal; `-1` first comes before second; `1` first comes after second
4257
4285
  */
4258
4286
  export declare function compare(first: unknown, second: unknown): number;
4259
- export declare namespace compare {
4260
- var deregister: typeof deregisterComparator;
4261
- var handler: {
4262
- base: {
4263
- handlers: WeakMap<WeakKey, string | GenericCallback>;
4264
- options: {
4265
- callback: GenericCallback;
4266
- method?: string;
4267
- };
4268
- owner: GenericCallback;
4269
- deregister: (constructor: Constructor) => void;
4270
- get: (first: unknown, second: unknown) => string | GenericCallback | undefined;
4271
- register: (constructor: Constructor, handler?: string | GenericCallback) => void;
4272
- };
4273
- handle(first: unknown, second: unknown, ...parameters: unknown[]): number;
4274
- };
4275
- var register: typeof registerComparator;
4276
- }
4277
4287
  /**
4278
4288
  * Deregister a custom comparison handler for a class
4279
4289
  *
@@ -4291,6 +4301,11 @@ export declare function deregisterComparator<Instance>(constructor: Constructor<
4291
4301
  * @param handler Method name or comparison function _(defaults to `compare`)_
4292
4302
  */
4293
4303
  export declare function registerComparator<Instance>(constructor: Constructor<Instance>, handler?: string | Comparator<Instance>): void;
4304
+ export declare namespace compare {
4305
+ export var deregister: typeof deregisterComparator;
4306
+ export var handler: CompareHandler<number>;
4307
+ export var register: typeof registerComparator;
4308
+ }
4294
4309
  //#endregion
4295
4310
  //#region src/internal/value/equal.d.ts
4296
4311
  /**
@@ -4347,17 +4362,6 @@ type Equalizer = {
4347
4362
  */
4348
4363
  register: <Instance>(constructor: Constructor<Instance>, handler: (first: Instance, second: Instance) => boolean) => void;
4349
4364
  };
4350
- type Options = {
4351
- ignoreCase: boolean;
4352
- ignoreExpressions: OptionsKeys<RegExp[]>;
4353
- ignoreKeys: OptionsKeys<Set<string>>;
4354
- relaxedNullish: boolean;
4355
- };
4356
- type OptionsKeys<Values> = {
4357
- enabled: boolean;
4358
- values: Values;
4359
- };
4360
- declare function Equalizer(this: any, options: Options): void;
4361
4365
  /**
4362
4366
  * Deregister a equality comparison handler for a specific class
4363
4367
  *
@@ -4384,25 +4388,6 @@ export declare function equal(first: string, second: string, ignoreCase?: boolea
4384
4388
  * @returns `true` if the values are equal, otherwise `false`
4385
4389
  */
4386
4390
  export declare function equal(first: unknown, second: unknown, options?: EqualOptions): boolean;
4387
- export declare namespace equal {
4388
- var deregister: typeof deregisterEqualizer;
4389
- var handler: {
4390
- base: {
4391
- handlers: WeakMap<WeakKey, string | GenericCallback>;
4392
- options: {
4393
- callback: GenericCallback;
4394
- method?: string;
4395
- };
4396
- owner: GenericCallback;
4397
- deregister: (constructor: Constructor) => void;
4398
- get: (first: unknown, second: unknown) => string | GenericCallback | undefined;
4399
- register: (constructor: Constructor, handler?: string | GenericCallback) => void;
4400
- };
4401
- handle(first: unknown, second: unknown, ...parameters: unknown[]): boolean;
4402
- };
4403
- var initialize: typeof initializeEqualizer;
4404
- var register: typeof registerEqualizer;
4405
- }
4406
4391
  /**
4407
4392
  * Create an equalizer with predefined options
4408
4393
  *
@@ -4421,6 +4406,12 @@ export declare function initializeEqualizer(options?: EqualOptions): Equalizer;
4421
4406
  * @param handler Comparison function
4422
4407
  */
4423
4408
  export declare function registerEqualizer<Instance>(constructor: Constructor<Instance>, handler: (first: Instance, second: Instance) => boolean): void;
4409
+ export declare namespace equal {
4410
+ export var deregister: typeof deregisterEqualizer;
4411
+ export var handler: CompareHandler<boolean>;
4412
+ export var initialize: typeof initializeEqualizer;
4413
+ export var register: typeof registerEqualizer;
4414
+ }
4424
4415
  //#endregion
4425
4416
  //#region src/internal/value/get.d.ts
4426
4417
  /**
@@ -4499,9 +4490,6 @@ export declare function hasValue<Data extends PlainObject, Path extends NestedKe
4499
4490
  * ```
4500
4491
  */
4501
4492
  export declare function hasValue<Data extends PlainObject>(data: Data, path: string, ignoreCase?: boolean): boolean;
4502
- export declare namespace hasValue {
4503
- var get: typeof hasValueResult;
4504
- }
4505
4493
  /**
4506
4494
  * Check if a property is defined in an object, and get its value if it is
4507
4495
  *
@@ -4544,6 +4532,9 @@ export declare function hasValueResult<Data extends PlainObject, Path extends Ne
4544
4532
  * ```
4545
4533
  */
4546
4534
  export declare function hasValueResult<Data extends PlainObject>(data: Data, path: string, ignoreCase?: boolean): Result<unknown, string>;
4535
+ export declare namespace hasValue {
4536
+ export var get: typeof hasValueResult;
4537
+ }
4547
4538
  //#endregion
4548
4539
  //#region src/internal/value/set.d.ts
4549
4540
  /**
@@ -4670,7 +4661,7 @@ export type PromiseParameters = {
4670
4661
  * - `complete`: wait for all _Promises_ to settle, then return the results, as an array of fulfilled and/or rejected results
4671
4662
  * - `first`: rejects on the first rejected _Promise_, and returns an array of values
4672
4663
  */
4673
- export type PromiseStrategy = 'complete' | 'first';
4664
+ export type PromiseStrategy = "complete" | "first";
4674
4665
  /**
4675
4666
  * An error thrown when a promise times out
4676
4667
  */
@@ -4759,7 +4750,7 @@ export declare function attemptPromise<Value>(callback: () => Value, options?: P
4759
4750
  * @param options Options for handling the _Promises_
4760
4751
  * @returns List of results
4761
4752
  */
4762
- export declare function promises<Items extends unknown[], Options extends PromisesOptions>(items: [...Items], options?: Options): Promise<Options['strategy'] extends 'first' ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
4753
+ export declare function promises<Items extends unknown[], Options extends PromisesOptions>(items: [...Items], options?: Options): Promise<Options["strategy"] extends "first" ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
4763
4754
  /**
4764
4755
  * Handle keyed _Promises_, returning their results in a similarly keyed object
4765
4756
  *
@@ -4769,7 +4760,7 @@ export declare function promises<Items extends unknown[], Options extends Promis
4769
4760
  * @param options Options for handling the _Promises_
4770
4761
  * @returns Keyed object of results
4771
4762
  */
4772
- export declare function promises<Items extends PlainObject, Options extends PromisesOptions>(items: Items, options?: Options): Promise<Options['strategy'] extends 'first' ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
4763
+ export declare function promises<Items extends PlainObject, Options extends PromisesOptions>(items: Items, options?: Options): Promise<Options["strategy"] extends "first" ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
4773
4764
  /**
4774
4765
  * Handle a list of _Promises_, returning their results in an ordered array
4775
4766
  *
@@ -4779,7 +4770,7 @@ export declare function promises<Items extends PlainObject, Options extends Prom
4779
4770
  * @param strategy Strategy for handling the _Promises_
4780
4771
  * @returns List of results
4781
4772
  */
4782
- export declare function promises<Items extends unknown[], Strategy extends PromiseStrategy>(items: [...Items], strategy: Strategy): Promise<Strategy extends 'first' ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
4773
+ export declare function promises<Items extends unknown[], Strategy extends PromiseStrategy>(items: [...Items], strategy: Strategy): Promise<Strategy extends "first" ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
4783
4774
  /**
4784
4775
  * Handle keyed _Promises_, returning their results in a similarly keyed object
4785
4776
  *
@@ -4789,7 +4780,7 @@ export declare function promises<Items extends unknown[], Strategy extends Promi
4789
4780
  * @param strategy Strategy for handling the _Promises_
4790
4781
  * @returns Keyed object of results
4791
4782
  */
4792
- export declare function promises<Items extends PlainObject, Strategy extends PromiseStrategy>(items: Items, strategy: Strategy): Promise<Strategy extends 'first' ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
4783
+ export declare function promises<Items extends PlainObject, Strategy extends PromiseStrategy>(items: Items, strategy: Strategy): Promise<Strategy extends "first" ? PromisesUnwrapped<Items> : PromisesValues<PromisesItems<Items>>>;
4793
4784
  /**
4794
4785
  * Handle a list of _Promises_, returning their results in an ordered array
4795
4786
  *
@@ -4806,9 +4797,6 @@ export declare function promises<Items extends unknown[]>(items: [...Items], sig
4806
4797
  * @returns Keyed object of results
4807
4798
  */
4808
4799
  export declare function promises<Items extends PlainObject>(items: Items, signal?: AbortSignal): Promise<PromisesValues<PromisesItems<Items>>>;
4809
- export declare namespace promises {
4810
- var result: typeof resultPromises;
4811
- }
4812
4800
  /**
4813
4801
  * Handle a list of _Promises_, returning their results in an ordered array of results _({@link Result})_
4814
4802
  *
@@ -4831,6 +4819,9 @@ export declare function resultPromises<Items extends unknown[]>(items: [...Items
4831
4819
  * @returns Keyed object of results
4832
4820
  */
4833
4821
  export declare function resultPromises<Items extends PlainObject>(items: Items, signal?: AbortSignal): Promise<PromisesResult<PromisesItems<Items>>>;
4822
+ export declare namespace promises {
4823
+ export var result: typeof resultPromises;
4824
+ }
4834
4825
  //#endregion
4835
4826
  //#region src/internal/result/misc.d.ts
4836
4827
  /**
@@ -4848,9 +4839,6 @@ export declare function error<E>(value: E, original: Error): ExtendedErr<E>;
4848
4839
  * @returns Error result
4849
4840
  */
4850
4841
  export declare function error<E>(value: E): Err<E>;
4851
- export declare namespace error {
4852
- var is: typeof isError;
4853
- }
4854
4842
  /**
4855
4843
  * Is the _Result_ an extended error?
4856
4844
  *
@@ -4910,9 +4898,6 @@ export declare function isResult(value: unknown): value is ExtendedErr<unknown>
4910
4898
  * @returns Ok result
4911
4899
  */
4912
4900
  export declare function ok<Value>(value: Value): Ok<Value>;
4913
- export declare namespace ok {
4914
- var is: typeof isOk;
4915
- }
4916
4901
  /**
4917
4902
  * Gets the value of an ok result _(or a default value)_
4918
4903
  *
@@ -4929,6 +4914,12 @@ export declare function unwrap<Value, E = Error>(value: Result<Value, E>, defaul
4929
4914
  * @returns Value of the _Result_ _(or the default value)_
4930
4915
  */
4931
4916
  export declare function unwrap(value: unknown, defaultValue: unknown): unknown;
4917
+ export declare namespace error {
4918
+ export var is: typeof isError;
4919
+ }
4920
+ export declare namespace ok {
4921
+ export var is: typeof isOk;
4922
+ }
4932
4923
  //#endregion
4933
4924
  //#region src/result/misc.d.ts
4934
4925
  /**
@@ -5000,7 +4991,7 @@ export declare function getTimedPromise<Value>(promise: Promise<Value>, time: nu
5000
4991
  * @param options Timed options
5001
4992
  * @returns Timed _Promise_
5002
4993
  */
5003
- export declare function timed<Value>(promise: Promise<Value>, options: RequiredKeys<PromiseOptions, 'time'>): Promise<Value>;
4994
+ export declare function timed<Value>(promise: Promise<Value>, options: RequiredKeys<PromiseOptions, "time">): Promise<Value>;
5004
4995
  /**
5005
4996
  * Create a _Promise_ that should be settled within a certain amount of time
5006
4997
  *
@@ -5065,7 +5056,7 @@ export declare function attempt<Value, E>(callback: () => Value, error: E): Exte
5065
5056
  */
5066
5057
  export declare function attempt<Value>(callback: () => Value): Result<Value, Error>;
5067
5058
  export declare namespace attempt {
5068
- var async: typeof asyncAttempt;
5059
+ export var async: typeof asyncAttempt;
5069
5060
  }
5070
5061
  //#endregion
5071
5062
  //#region src/result/match.d.ts
@@ -5089,7 +5080,7 @@ export declare function asyncMatchResult<Value, Returned, E = Error>(result: Any
5089
5080
  * @param error Error callback
5090
5081
  * @returns Matched value-_Promise_
5091
5082
  */
5092
- export declare function asyncMatchResult<Value, Returned, E = Error>(result: AnyResult<Value, E> | Promise<AnyResult<Value, E>> | (() => Promise<AnyResult<Value, E>>), ok: ResultMatch<Value, Returned, E>['ok'], error: ResultMatch<Value, Returned, E>['error']): Promise<Returned>;
5083
+ export declare function asyncMatchResult<Value, Returned, E = Error>(result: AnyResult<Value, E> | Promise<AnyResult<Value, E>> | (() => Promise<AnyResult<Value, E>>), ok: ResultMatch<Value, Returned, E>["ok"], error: ResultMatch<Value, Returned, E>["error"]): Promise<Returned>;
5093
5084
  /**
5094
5085
  * Handles a _Result_ with match callbacks
5095
5086
  *
@@ -5106,9 +5097,9 @@ export declare function matchResult<Value, Returned, E = Error>(result: AnyResul
5106
5097
  * @param error Error callback
5107
5098
  * @returns Matched value
5108
5099
  */
5109
- export declare function matchResult<Value, Returned, E = Error>(result: AnyResult<Value, E> | (() => AnyResult<Value, E>), ok: ResultMatch<Value, Returned, E>['ok'], error: ResultMatch<Value, Returned, E>['error']): Returned;
5100
+ export declare function matchResult<Value, Returned, E = Error>(result: AnyResult<Value, E> | (() => AnyResult<Value, E>), ok: ResultMatch<Value, Returned, E>["ok"], error: ResultMatch<Value, Returned, E>["error"]): Returned;
5110
5101
  export declare namespace matchResult {
5111
- var async: typeof asyncMatchResult;
5102
+ export var async: typeof asyncMatchResult;
5112
5103
  }
5113
5104
  //#endregion
5114
5105
  //#region src/result/work/flow.d.ts
@@ -5289,7 +5280,7 @@ export declare function attemptFlow<First extends GenericCallback>(first: First,
5289
5280
  */
5290
5281
  export declare function attemptFlow(...fns: GenericCallback[]): (...args: unknown[]) => Result<unknown>;
5291
5282
  export declare namespace attemptFlow {
5292
- var async: typeof attemptAsyncFlow;
5283
+ export var async: typeof attemptAsyncFlow;
5293
5284
  }
5294
5285
  //#endregion
5295
5286
  //#region src/result/work/pipe.d.ts
@@ -5471,7 +5462,7 @@ export declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth
5471
5462
  */
5472
5463
  export declare function attemptPipe<Initial>(initial: GenericCallback | Initial | Result<Initial>, first?: (value: UnwrapValue<Initial>) => unknown, ...seconds: Array<(value: unknown) => unknown>): WrapValue<Initial>;
5473
5464
  export declare namespace attemptPipe {
5474
- var async: typeof attemptAsyncPipe;
5465
+ export var async: typeof attemptAsyncPipe;
5475
5466
  }
5476
5467
  //#endregion
5477
5468
  //#region src/string/fuzzy.d.ts
@@ -5584,10 +5575,6 @@ export declare function fuzzy<Item>(items: Item[], handler?: (item: Item) => str
5584
5575
  * @returns Fuzzy searcher
5585
5576
  */
5586
5577
  export declare function fuzzy<Item>(items: Item[], configuration?: FuzzyConfiguration<Item>): Fuzzy<Item>;
5587
- export declare namespace fuzzy {
5588
- var is: typeof isFuzzy;
5589
- var match: typeof fuzzyMatch;
5590
- }
5591
5578
  /**
5592
5579
  * Does the needle match the haystack in a fuzzy way?
5593
5580
  *
@@ -5607,6 +5594,10 @@ export declare function fuzzyMatch(haystack: string, needle: string): boolean;
5607
5594
  * @returns `true` if the value is a fuzzy searcher, otherwise `false`
5608
5595
  */
5609
5596
  export declare function isFuzzy<Item = unknown>(value: unknown): value is Fuzzy<Item>;
5597
+ export declare namespace fuzzy {
5598
+ export var is: typeof isFuzzy;
5599
+ export var match: typeof fuzzyMatch;
5600
+ }
5610
5601
  //#endregion
5611
5602
  //#region src/string/index.d.ts
5612
5603
  /**
@@ -5756,7 +5747,7 @@ export declare function initializeNormalizer(options?: NormalizeOptions): Normal
5756
5747
  */
5757
5748
  export declare function normalize(value: string, options?: NormalizeOptions): string;
5758
5749
  export declare namespace normalize {
5759
- var initialize: typeof initializeNormalizer;
5750
+ export var initialize: typeof initializeNormalizer;
5760
5751
  }
5761
5752
  //#endregion
5762
5753
  //#region src/string/template.d.ts
@@ -5801,7 +5792,6 @@ type Templater = {
5801
5792
  * Render a template string with variables
5802
5793
  */
5803
5794
  type TemplaterRenderer = (variables?: PlainObject) => string;
5804
- declare function Templater(this: any, options: Required<TemplateOptions>): void;
5805
5795
  /**
5806
5796
  * Create a _Templater_ with predefined options
5807
5797
  *
@@ -5827,7 +5817,7 @@ export declare function template(strings: TemplateStringsArray, ...values: unkno
5827
5817
  */
5828
5818
  export declare function template(value: string, variables?: PlainObject, options?: Partial<TemplateOptions>): string;
5829
5819
  export declare namespace template {
5830
- var initialize: typeof initializeTemplater;
5820
+ export var initialize: typeof initializeTemplater;
5831
5821
  }
5832
5822
  //#endregion
5833
5823
  //#region src/value/clone.d.ts
@@ -5878,25 +5868,6 @@ export type Cloner = {
5878
5868
  * @returns Cloned value
5879
5869
  */
5880
5870
  export declare function clone<Value>(value: Value, options?: CloneOptions): Value;
5881
- export declare namespace clone {
5882
- var deregister: typeof deregisterCloner;
5883
- var handlers: {
5884
- base: {
5885
- handlers: WeakMap<WeakKey, string | GenericCallback>;
5886
- options: {
5887
- callback: GenericCallback;
5888
- method?: string;
5889
- };
5890
- owner: GenericCallback;
5891
- deregister: (constructor: Constructor) => void;
5892
- get: (first: unknown, second: unknown) => string | GenericCallback | undefined;
5893
- register: (constructor: Constructor, handler?: string | GenericCallback) => void;
5894
- };
5895
- handle(value: unknown, ...parameters: unknown[]): unknown;
5896
- };
5897
- var initialize: typeof initializeCloner;
5898
- var register: typeof registerCloner;
5899
- }
5900
5871
  /**
5901
5872
  * Copy any kind of value
5902
5873
  *
@@ -5933,6 +5904,12 @@ export declare function initializeCloner(options?: CloneOptions): Cloner;
5933
5904
  * @param handler Method name or clone function _(defaults to method name `clone`)_
5934
5905
  */
5935
5906
  export declare function registerCloner<Instance>(constructor: Constructor<Instance>, handler?: string | ((value: Instance) => Instance)): void;
5907
+ export declare namespace clone {
5908
+ export var deregister: typeof deregisterCloner;
5909
+ export var handlers: ValueHandler;
5910
+ export var initialize: typeof initializeCloner;
5911
+ export var register: typeof registerCloner;
5912
+ }
5936
5913
  //#endregion
5937
5914
  //#region src/value/collection.d.ts
5938
5915
  /**
@@ -5991,7 +5968,7 @@ export type DiffResult<First, Second = First> = {
5991
5968
  */
5992
5969
  values: Record<string, DiffValue>;
5993
5970
  };
5994
- type DiffType = 'full' | 'none' | 'partial';
5971
+ type DiffType = "full" | "none" | "partial";
5995
5972
  /**
5996
5973
  * The difference between two values
5997
5974
  */
@@ -6144,10 +6121,6 @@ export declare function freeze<Item>(set: Set<Item>): Frozen<Set<Item>>;
6144
6121
  * @returns Frozen value
6145
6122
  */
6146
6123
  export declare function freeze<Value>(value: Value): Value;
6147
- export declare namespace freeze {
6148
- var flat: typeof flatFreeze;
6149
- var is: typeof isFrozen;
6150
- }
6151
6124
  /**
6152
6125
  * Is the value frozen?
6153
6126
  *
@@ -6157,6 +6130,10 @@ export declare namespace freeze {
6157
6130
  * @returns `true` if the value is frozen, otherwise `false`
6158
6131
  */
6159
6132
  export declare function isFrozen(value: unknown): boolean;
6133
+ export declare namespace freeze {
6134
+ export var flat: typeof flatFreeze;
6135
+ export var is: typeof isFrozen;
6136
+ }
6160
6137
  //#endregion
6161
6138
  //#region src/value/omit.d.ts
6162
6139
  /**
@@ -6225,7 +6202,7 @@ export declare function unsmush<Value extends PlainObject>(value: Value): Unsmus
6225
6202
  /**
6226
6203
  * Options for assigning values
6227
6204
  */
6228
- export type AssignOptions = Omit<MergeOptions, 'assignValues'>;
6205
+ export type AssignOptions = Omit<MergeOptions, "assignValues">;
6229
6206
  /**
6230
6207
  * An assigner function for assigning values from one or more objects to the first one
6231
6208
  */
@@ -6293,9 +6270,6 @@ export type Merger = {
6293
6270
  * @returns Assigned value
6294
6271
  */
6295
6272
  export declare function assign<To extends PlainObject, From extends PlainObject[]>(to: To, from: [...From], options?: AssignOptions): To & UnionToIntersection<From[number]>;
6296
- export declare namespace assign {
6297
- var initialize: typeof initializeAssigner;
6298
- }
6299
6273
  /**
6300
6274
  * Create an assigner with predefined options
6301
6275
  *
@@ -6322,8 +6296,11 @@ export declare function initializeMerger(options?: MergeOptions): Merger;
6322
6296
  * @returns Merged value
6323
6297
  */
6324
6298
  export declare function merge<Values extends ArrayOrPlainObject[]>(values: [...Values], options?: MergeOptions): UnionToIntersection<Values[number]>;
6299
+ export declare namespace assign {
6300
+ export var initialize: typeof initializeAssigner;
6301
+ }
6325
6302
  export declare namespace merge {
6326
- var initialize: typeof initializeMerger;
6303
+ export var initialize: typeof initializeMerger;
6327
6304
  }
6328
6305
  //#endregion
6329
6306
  //#region src/value/transform.d.ts
@@ -6382,7 +6359,7 @@ export declare function transform<Value extends PlainObject, Key extends keyof V
6382
6359
  */
6383
6360
  export declare function transform<Value extends PlainObject>(value: Value, transformers: TransformCallbacks<Value>): Value;
6384
6361
  export declare namespace transform {
6385
- var initialize: typeof initializeTransformer;
6362
+ export var initialize: typeof initializeTransformer;
6386
6363
  }
6387
6364
  //#endregion
6388
6365
  //#region src/internal/subscription.d.ts
@@ -6658,7 +6635,7 @@ type Herald<Events extends Record<string, GenericCallback>> = {
6658
6635
  */
6659
6636
  subscribe<Event extends keyof Events>(event: Event, callback: Events[Event], signal?: AbortSignal): Subscription;
6660
6637
  };
6661
- type HeraldEvents<Events extends Record<string, GenericCallback>> = { [Key in keyof Events]: Key extends '*' ? never : (callback: Events[Key], signal?: AbortSignal) => void; };
6638
+ type HeraldEvents<Events extends Record<string, GenericCallback>> = { [Key in keyof Events]: Key extends "*" ? never : (callback: Events[Key], signal?: AbortSignal) => void; };
6662
6639
  type HeraldOnCreate<Events extends Record<string, GenericCallback>> = <Event extends keyof Events>(event: Event, callback: Events[Event], subscription: Subscription) => void;
6663
6640
  type HeraldOptions<Events extends Record<string, GenericCallback>> = {
6664
6641
  names: Array<keyof Events>;
@@ -6877,7 +6854,7 @@ type Color = {
6877
6854
  unsubscribe(): void;
6878
6855
  };
6879
6856
  type ColorChanges = {
6880
- '*': (value: Color) => void;
6857
+ "*": (value: Color) => void;
6881
6858
  alpha: (value: number) => void;
6882
6859
  hex: (value: string) => void;
6883
6860
  hexa: (value: string) => void;
@@ -6954,11 +6931,11 @@ type RGBColor = {
6954
6931
  /**
6955
6932
  * Base color types
6956
6933
  */
6957
- type ColorType = 'hex' | 'hsl' | 'hwb' | 'rgb';
6934
+ type ColorType = "hex" | "hsl" | "hwb" | "rgb";
6958
6935
  /**
6959
6936
  * Extended color types
6960
6937
  */
6961
- type ColorTypeExtended = ColorType | 'hsla' | 'hwba' | 'rgba';
6938
+ type ColorTypeExtended = ColorType | "hsla" | "hwba" | "rgba";
6962
6939
  /**
6963
6940
  * Base color values
6964
6941
  */
@@ -7451,6 +7428,13 @@ export declare function isNonPlainObject<Value>(value: Value): value is Exclude<
7451
7428
  * @returns `true` if the value is not a primitive value, otherwise `false`
7452
7429
  */
7453
7430
  export declare function isNonPrimitive<Value>(value: Value): value is Exclude<Value, Primitive>;
7431
+ /**
7432
+ * Is the value not a template strings array?
7433
+ *
7434
+ * @param value Value to check
7435
+ * @returns `true` if the value is not a `TemplateStringsArray`, otherwise `false`
7436
+ */
7437
+ export declare function isNonTemplateStringsArray<Value>(value: Value): value is Exclude<Value, TemplateStringsArray>;
7454
7438
  /**
7455
7439
  * Is the value not a typed array?
7456
7440
  *
@@ -7479,6 +7463,13 @@ export declare function isPlainObject(value: unknown): value is PlainObject;
7479
7463
  * @returns `true` if the value is a primitive value, otherwise `false`
7480
7464
  */
7481
7465
  export declare function isPrimitive(value: unknown): value is Primitive;
7466
+ /**
7467
+ * Is the value a template strings array?
7468
+ *
7469
+ * @param value Value to check
7470
+ * @returns `true` if the value is a `TemplateStringsArray`, otherwise `false`
7471
+ */
7472
+ export declare function isTemplateStringsArray(value: unknown): value is TemplateStringsArray;
7482
7473
  /**
7483
7474
  * Is the value a typed array?
7484
7475
  *
@@ -7515,14 +7506,14 @@ export declare function isNonNullable<Value>(value: Value): value is Exclude<Val
7515
7506
  * @param value Value to check
7516
7507
  * @returns `true` if the value is not `undefined`, `null`, or matches an empty string, otherwise `false`
7517
7508
  */
7518
- export declare function isNonNullableOrEmpty<Value>(value: Value): value is Exclude<Value, undefined | null | ''>;
7509
+ export declare function isNonNullableOrEmpty<Value>(value: Value): value is Exclude<Value, undefined | null | "">;
7519
7510
  /**
7520
7511
  * Is the value not `undefined`, `null`, or stringified as a whitespace-only string?
7521
7512
  *
7522
7513
  * @param value Value to check
7523
7514
  * @returns `true` if the value is not `undefined`, `null`, or matches a whitespace-only string, otherwise `false`
7524
7515
  */
7525
- export declare function isNonNullableOrWhitespace<Value>(value: Value): value is Exclude<Value, undefined | null | ''>;
7516
+ export declare function isNonNullableOrWhitespace<Value>(value: Value): value is Exclude<Value, undefined | null | "">;
7526
7517
  /**
7527
7518
  * Is the value not a number or a number-like string?
7528
7519
  *
@@ -7550,14 +7541,14 @@ export declare function isNullable(value: unknown): value is undefined | null;
7550
7541
  * @param value Value to check
7551
7542
  * @returns `true` if the value is nullable or matches an empty string, otherwise `false`
7552
7543
  */
7553
- export declare function isNullableOrEmpty(value: unknown): value is undefined | null | '';
7544
+ export declare function isNullableOrEmpty(value: unknown): value is undefined | null | "";
7554
7545
  /**
7555
7546
  * Is the value `undefined`, `null`, or stringified as a whitespace-only string?
7556
7547
  *
7557
7548
  * @param value Value to check
7558
7549
  * @returns `true` if the value is nullable or matches a whitespace-only string, otherwise `false`
7559
7550
  */
7560
- export declare function isNullableOrWhitespace(value: unknown): value is undefined | null | '';
7551
+ export declare function isNullableOrWhitespace(value: unknown): value is undefined | null | "";
7561
7552
  /**
7562
7553
  * Is the value a number or a number-like string?
7563
7554
  *
@@ -8205,7 +8196,7 @@ export declare function queue<Callback extends GenericAsyncCallback>(callback: C
8205
8196
  */
8206
8197
  export declare function queue<Callback extends GenericCallback>(callback: Callback, options?: QueueOptions): Queue<Callback, Parameters<Callback>>;
8207
8198
  export declare namespace queue {
8208
- var keyed: typeof keyedQueue;
8199
+ export var keyed: typeof keyedQueue;
8209
8200
  }
8210
8201
  //#endregion
8211
8202
  //#region src/internal/random.d.ts
@@ -8315,7 +8306,7 @@ export declare class SizedSet<Value = unknown> extends Set<Value> {
8315
8306
  /**
8316
8307
  * @inheritdoc
8317
8308
  */
8318
- add(value: Value): this;
8309
+ override add(value: Value): this;
8319
8310
  /**
8320
8311
  * Get a value from the _SizedSet_, if it exists _(and optionally move it to the end)_
8321
8312
  *
@@ -8326,4 +8317,4 @@ export declare class SizedSet<Value = unknown> extends Set<Value> {
8326
8317
  get(value: Value, update?: boolean): Value | undefined;
8327
8318
  }
8328
8319
  //#endregion
8329
- export { type AsyncLimiter, type Color, type ColorType, type ColorTypeExtended, type ColorValue, type ColorValueExtended, type HSLAColor, type HSLColor, type HWBAColor, type HWBColor, Key$1 as Key, type Limiter, Logger, Once, OnceAsync, type RGBAColor, type RGBColor, type Shaken, type Smushed, type Subscription, type SubscriptionParameters, type SubscriptionProperty, type Subscriptions, type SubscriptionsParameters, type TimeLogger, type Unsmushed, toPromise as fromResult, getRandomFloatingNumber as getRandomFloat, isLogger, isTimeLogger };
8320
+ export { type AsyncLimiter, type Color, type ColorType, type ColorTypeExtended, type ColorValue, type ColorValueExtended, type HSLAColor, type HSLColor, type HWBAColor, type HWBColor, Key$1 as Key, type Limiter, Logger, type RGBAColor, type RGBColor, type Shaken, type Smushed, type Subscription, type SubscriptionParameters, type SubscriptionProperty, type Subscriptions, type SubscriptionsParameters, type TimeLogger, type Unsmushed, push as append, filterAndMap as select, toPromise as fromResult, getRandomFloatingNumber as getRandomFloat, isLogger, isTimeLogger, mapAndFilter as reverseSelect };