@oscarpalmer/atoms 0.166.2 → 0.167.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 (68) hide show
  1. package/dist/array/difference.d.mts +1 -1
  2. package/dist/array/exists.d.mts +1 -1
  3. package/dist/array/filter.d.mts +2 -2
  4. package/dist/array/find.d.mts +1 -1
  5. package/dist/array/intersection.d.mts +1 -1
  6. package/dist/array/move.d.mts +2 -2
  7. package/dist/array/partition.d.mts +1 -1
  8. package/dist/array/select.d.mts +1 -1
  9. package/dist/array/slice.d.mts +2 -2
  10. package/dist/array/sort.d.mts +4 -4
  11. package/dist/array/swap.d.mts +2 -2
  12. package/dist/array/to-set.d.mts +1 -1
  13. package/dist/array/toggle.d.mts +1 -1
  14. package/dist/array/union.d.mts +1 -1
  15. package/dist/array/update.d.mts +1 -1
  16. package/dist/index.d.mts +243 -211
  17. package/dist/index.mjs +29 -29
  18. package/dist/internal/array/index-of.d.mts +1 -1
  19. package/dist/internal/math/aggregate.d.mts +1 -1
  20. package/dist/internal/value/partial.d.mts +2 -2
  21. package/dist/math.d.mts +1 -1
  22. package/dist/models.d.mts +7 -7
  23. package/dist/promise/index.d.mts +2 -7
  24. package/dist/promise/index.mjs +5 -7
  25. package/dist/promise/misc.d.mts +3 -1
  26. package/dist/promise/misc.mjs +3 -2
  27. package/dist/promise/models.d.mts +4 -4
  28. package/dist/result/index.d.mts +2 -5
  29. package/dist/result/index.mjs +2 -4
  30. package/dist/result/misc.d.mts +2 -1
  31. package/dist/result/misc.mjs +2 -2
  32. package/dist/sized/map.d.mts +11 -11
  33. package/dist/value/omit.d.mts +1 -1
  34. package/dist/value/pick.d.mts +1 -1
  35. package/dist/value/smush.d.mts +1 -1
  36. package/dist/value/unsmush.d.mts +1 -1
  37. package/package.json +30 -2
  38. package/src/array/difference.ts +2 -2
  39. package/src/array/exists.ts +3 -3
  40. package/src/array/filter.ts +6 -6
  41. package/src/array/find.ts +3 -3
  42. package/src/array/intersection.ts +2 -2
  43. package/src/array/move.ts +4 -4
  44. package/src/array/partition.ts +3 -3
  45. package/src/array/select.ts +3 -3
  46. package/src/array/slice.ts +6 -6
  47. package/src/array/sort.ts +4 -4
  48. package/src/array/swap.ts +4 -4
  49. package/src/array/to-set.ts +3 -3
  50. package/src/array/toggle.ts +2 -2
  51. package/src/array/union.ts +2 -2
  52. package/src/array/update.ts +2 -2
  53. package/src/index.ts +9 -0
  54. package/src/internal/array/index-of.ts +3 -3
  55. package/src/internal/math/aggregate.ts +2 -2
  56. package/src/internal/value/partial.ts +9 -9
  57. package/src/math.ts +3 -3
  58. package/src/models.ts +30 -20
  59. package/src/promise/index.ts +0 -22
  60. package/src/promise/misc.ts +7 -0
  61. package/src/promise/models.ts +13 -11
  62. package/src/result/index.ts +0 -9
  63. package/src/result/misc.ts +6 -0
  64. package/src/sized/map.ts +14 -14
  65. package/src/value/omit.ts +3 -3
  66. package/src/value/pick.ts +3 -3
  67. package/src/value/smush.ts +1 -1
  68. package/src/value/unsmush.ts +1 -1
package/dist/index.d.mts CHANGED
@@ -40,8 +40,8 @@ type GenericCallback = (...args: any[]) => any;
40
40
  /**
41
41
  * A generic key type
42
42
  */
43
- type Key$1 = number | string;
44
- type KeyedValue<Item, Key extends keyof Item> = Item[Key] extends PropertyKey ? Item[Key] : never;
43
+ type Key = number | string;
44
+ type KeyedValue<Item, ItemKey extends keyof Item> = Item[ItemKey] extends PropertyKey ? Item[ItemKey] : never;
45
45
  /**
46
46
  * A nested array
47
47
  */
@@ -50,16 +50,16 @@ type NestedArray<Value> = Value extends Array<infer NestedValue> ? NestedArray<N
50
50
  * All nested keys of an object as dot notation strings _(up to 5 levels deep)_
51
51
  */
52
52
  type NestedKeys<Value extends PlainObject> = _NestedKeys<Value>;
53
- type _NestedKeys<Value, Depth extends number = 5> = Depth extends 0 ? never : Value extends readonly any[] ? Value extends readonly [any, ...any] ? { [Key in keyof Value]-?: Key$1 extends `${number}` ? NonNullable<Value[Key$1]> extends readonly any[] | PlainObject ? `${Key$1}` | `${Key$1}.${_NestedKeys<NonNullable<Value[Key$1]>, SubtractDepth<Depth>>}` : `${Key$1}` : never }[number] : never : Value extends PlainObject ? { [Key in keyof Value]-?: Key$1 extends number | string ? NonNullable<Value[Key$1]> extends readonly any[] | PlainObject ? `${Key$1}` | `${Key$1}.${_NestedKeys<NonNullable<Value[Key$1]>, SubtractDepth<Depth>>}` : `${Key$1}` : never }[keyof Value] : never;
53
+ type _NestedKeys<Value, Depth extends number = 5> = Depth extends 0 ? never : Value extends readonly any[] ? Value extends readonly [any, ...any] ? { [ItemKey in keyof Value]-?: ItemKey extends `${number}` ? NonNullable<Value[ItemKey]> extends readonly any[] | PlainObject ? `${ItemKey}` | `${ItemKey}.${_NestedKeys<NonNullable<Value[ItemKey]>, SubtractDepth<Depth>>}` : `${ItemKey}` : never }[number] : never : Value extends PlainObject ? { [ItemKey in keyof Value]-?: ItemKey extends number | string ? NonNullable<Value[ItemKey]> extends readonly any[] | PlainObject ? `${ItemKey}` | `${ItemKey}.${_NestedKeys<NonNullable<Value[ItemKey]>, SubtractDepth<Depth>>}` : `${ItemKey}` : never }[keyof Value] : never;
54
54
  /**
55
55
  * An extended version of `Partial` that allows for nested properties to be optional
56
56
  */
57
- type NestedPartial<Value> = { [Key in keyof Value]?: Value[Key$1] extends object ? NestedPartial<Value[Key$1]> : Value[Key$1] };
57
+ type NestedPartial<Value> = { [ItemKey in keyof Value]?: Value[ItemKey] extends object ? NestedPartial<Value[ItemKey]> : Value[ItemKey] };
58
58
  /**
59
59
  * The value for a nested key of an object
60
60
  */
61
61
  type NestedValue<Value extends PlainObject, Path extends string> = _NestedValue<Value, Path>;
62
- type _NestedValue<Value, Path extends string> = Path extends `${infer Key}.${infer Rest}` ? Key extends keyof Value ? undefined extends Value[Key$1] ? _NestedValue<Exclude<Value[Key$1], undefined>, Rest> | undefined : _NestedValue<Value[Key$1], Rest> : Key extends `${number}` ? Value extends readonly any[] ? _NestedValue<Value[number], Rest> : never : never : Path extends `${number}` ? Value extends readonly any[] ? Value[number] : never : Path extends keyof Value ? Value[Path] : never;
62
+ type _NestedValue<Value, Path extends string> = Path extends `${infer ItemKey}.${infer Rest}` ? ItemKey extends keyof Value ? undefined extends Value[ItemKey] ? _NestedValue<Exclude<Value[ItemKey], undefined>, Rest> | undefined : _NestedValue<Value[ItemKey], Rest> : ItemKey extends `${number}` ? Value extends readonly any[] ? _NestedValue<Value[number], Rest> : never : never : Path extends `${number}` ? Value extends readonly any[] ? Value[number] : never : Path extends keyof Value ? Value[Path] : never;
63
63
  /**
64
64
  * The nested (keyed) values of an object _(up to 5 levels deep)_
65
65
  */
@@ -67,11 +67,11 @@ type NestedValues<Value extends PlainObject> = { [Path in NestedKeys<Value>]: Ne
67
67
  /**
68
68
  * The numerical keys of an object
69
69
  */
70
- type NumericalKeys<Value> = { [Key in keyof Value]: Key$1 extends number ? Key$1 : Key$1 extends `${number}` ? Key$1 : never }[keyof Value];
70
+ type NumericalKeys<Value> = { [ItemKey in keyof Value]: ItemKey extends number ? ItemKey : ItemKey extends `${number}` ? ItemKey : never }[keyof Value];
71
71
  /**
72
72
  * The numerical values of an object
73
73
  */
74
- type NumericalValues<Item extends PlainObject> = { [Key in keyof Item as Item[Key$1] extends number ? Key$1 : never]: Item[Key$1] };
74
+ type NumericalValues<Item extends PlainObject> = { [ItemKey in keyof Item as Item[ItemKey] extends number ? ItemKey : never]: Item[ItemKey] };
75
75
  /**
76
76
  * An asynchronous function that can only be called once, returning the same value on subsequent calls
77
77
  */
@@ -122,7 +122,7 @@ type RequiredKeys<Model extends object, Keys extends keyof Model> = Required<Pic
122
122
  *
123
123
  * _(Thanks, type-fest!)_
124
124
  */
125
- type Simplify<Value> = { [Key in keyof Value]: Value[Key$1] } & {};
125
+ type Simplify<Value> = { [ValueKey in keyof Value]: Value[ValueKey] } & {};
126
126
  type SubtractDepth<Value extends number> = Value extends 5 ? 4 : Value extends 4 ? 3 : Value extends 3 ? 2 : Value extends 2 ? 1 : Value extends 1 ? 0 : never;
127
127
  /**
128
128
  * Get the value's type as a string
@@ -151,7 +151,7 @@ declare function filter<Item, Callback extends (item: Item, index: number, array
151
151
  * @param value Value to match against
152
152
  * @returns Filtered array of items
153
153
  */
154
- declare function filter<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): Item[];
154
+ declare function filter<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item[];
155
155
  /**
156
156
  * Get a filtered array of items matching the filter
157
157
  * @param array Array to search in
@@ -170,7 +170,7 @@ declare namespace filter {
170
170
  var remove: typeof removeFiltered;
171
171
  }
172
172
  declare function removeFiltered<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): unknown[];
173
- declare function removeFiltered<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): unknown[];
173
+ declare function removeFiltered<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): unknown[];
174
174
  declare function removeFiltered<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): unknown[];
175
175
  declare function removeFiltered<Item>(array: Item[], item: Item): unknown[];
176
176
  //#endregion
@@ -184,7 +184,7 @@ declare function removeFiltered<Item>(array: Item[], item: Item): unknown[];
184
184
  * @param value Callback to get an item's value
185
185
  * @returns Record of keyed values
186
186
  */
187
- declare function groupBy<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Simplify<Record<ReturnType<KeyCallback>, ReturnType<ValueCallback>>>;
187
+ declare function groupBy<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Simplify<Record<ReturnType<KeyCallback>, ReturnType<ValueCallback>>>;
188
188
  /**
189
189
  * Create a record from an array of items using a specific key and value
190
190
  *
@@ -194,7 +194,7 @@ declare function groupBy<Item, KeyCallback extends (item: Item, index: number, a
194
194
  * @param value Key to use for value
195
195
  * @returns Record of keyed values
196
196
  */
197
- declare function groupBy<Item extends PlainObject, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ItemValue extends keyof Item>(array: Item[], key: KeyCallback, value: ItemValue): Record<ReturnType<KeyCallback>, Item[ItemValue]>;
197
+ declare function groupBy<Item extends PlainObject, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ItemValue extends keyof Item>(array: Item[], key: KeyCallback, value: ItemValue): Record<ReturnType<KeyCallback>, Item[ItemValue]>;
198
198
  /**
199
199
  * Create a record from an array of items using a specific key and value
200
200
  *
@@ -223,7 +223,7 @@ declare function groupBy<Item extends PlainObject, ItemKey extends keyof Item, I
223
223
  * @param callback Callback to get an item's grouping key
224
224
  * @returns Record of keyed items
225
225
  */
226
- declare function groupBy<Item, Callback extends (item: Item, index: number, array: Item[]) => Key$1>(array: Item[], callback: Callback): Record<ReturnType<Callback>, Item>;
226
+ declare function groupBy<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], callback: Callback): Record<ReturnType<Callback>, Item>;
227
227
  /**
228
228
  * Create a record from an array of items using a specific key
229
229
  *
@@ -249,7 +249,7 @@ declare namespace groupBy {
249
249
  * @param value Callback to get an item's value
250
250
  * @returns Record of keyed values
251
251
  */
252
- declare function groupArraysBy<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, ReturnType<ValueCallback>[]>;
252
+ declare function groupArraysBy<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, ReturnType<ValueCallback>[]>;
253
253
  /**
254
254
  * Create a record from an array of items using a specific key and value, grouping values into arrays
255
255
  * @param array Array to group
@@ -257,7 +257,7 @@ declare function groupArraysBy<Item, KeyCallback extends (item: Item, index: num
257
257
  * @param value Key to use for value
258
258
  * @returns Record of keyed values
259
259
  */
260
- declare function groupArraysBy<Item extends PlainObject, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ItemValue extends keyof Item>(array: Item[], key: KeyCallback, value: ItemValue): Record<ReturnType<KeyCallback>, Item[ItemValue][]>;
260
+ declare function groupArraysBy<Item extends PlainObject, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ItemValue extends keyof Item>(array: Item[], key: KeyCallback, value: ItemValue): Record<ReturnType<KeyCallback>, Item[ItemValue][]>;
261
261
  /**
262
262
  * Create a record from an array of items using a specific key and value, grouping values into arrays
263
263
  * @param array Array to group
@@ -280,7 +280,7 @@ declare function groupArraysBy<Item extends PlainObject, ItemKey extends keyof I
280
280
  * @param callback Callback to get an item's grouping key
281
281
  * @returns Record of keyed items
282
282
  */
283
- declare function groupArraysBy<Item, Callback extends (item: Item, index: number, array: Item[]) => Key$1>(array: Item[], callback: Callback): Record<ReturnType<Callback>, Item[]>;
283
+ declare function groupArraysBy<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], callback: Callback): Record<ReturnType<Callback>, Item[]>;
284
284
  /**
285
285
  * Create a record from an array of items using a specific key, grouping items into arrays
286
286
  * @param array Array to group
@@ -329,7 +329,7 @@ declare function indexOf<Item, Callback extends (item: Item, index: number, arra
329
329
  * @param value Value to match against
330
330
  * @returns Index of the first matching item, or `-1` if no match is found
331
331
  */
332
- declare function indexOf<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): number;
332
+ declare function indexOf<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): number;
333
333
  /**
334
334
  * Get the index of the first item matching the filter
335
335
  * @param array Array to search in
@@ -369,7 +369,7 @@ declare function difference<First, Second>(first: First[], second: Second[], cal
369
369
  * @param key Key to get an item's value for comparison
370
370
  * @returns Unique values from the first array
371
371
  */
372
- declare function difference<First extends PlainObject, Second extends PlainObject, Key extends keyof First & keyof Second>(first: First[], second: Second[], key: Key): First[];
372
+ declare function difference<First extends PlainObject, Second extends PlainObject, SharedKey extends keyof First & keyof Second>(first: First[], second: Second[], key: SharedKey): First[];
373
373
  /**
374
374
  * Get the items from the first array that are not in the second array
375
375
  * @param first First array
@@ -394,7 +394,7 @@ declare function exists<Item, Callback extends (item: Item, index: number, array
394
394
  * @param value Value to match against
395
395
  * @returns `true` if the item exists in the array, otherwise `false`
396
396
  */
397
- declare function exists<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): boolean;
397
+ declare function exists<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): boolean;
398
398
  /**
399
399
  * Does an item in the array match the filter?
400
400
  * @param array Array to search in
@@ -426,7 +426,7 @@ declare function find<Item, Callback extends (item: Item, index: number, array:
426
426
  * @param value Value to match against
427
427
  * @returns First item that matches the value, or `undefined` if no match is found
428
428
  */
429
- declare function find<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): Item | undefined;
429
+ declare function find<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item | undefined;
430
430
  /**
431
431
  * Get the first item matching the filter
432
432
  * @param array Array to search in
@@ -558,7 +558,7 @@ declare function intersection<First, Second>(first: First[], second: Second[], c
558
558
  * @param key Key to get an item's value for comparison
559
559
  * @returns Common values from both arrays
560
560
  */
561
- declare function intersection<First extends Record<string, unknown>, Second extends Record<string, unknown>, Key extends keyof First & keyof Second>(first: First[], second: Second[], key: Key): First[];
561
+ declare function intersection<First extends Record<string, unknown>, Second extends Record<string, unknown>, SharedKey extends keyof First & keyof Second>(first: First[], second: Second[], key: SharedKey): First[];
562
562
  /**
563
563
  * Get the common values between two arrays
564
564
  * @param first First array
@@ -583,7 +583,7 @@ declare function partition<Item, Callback extends (item: Item, index: number, ar
583
583
  * @param value Value to match against
584
584
  * @returns Partitioned array of items
585
585
  */
586
- declare function partition<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): Item[][];
586
+ declare function partition<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item[][];
587
587
  /**
588
588
  * Get a partitioned array of items
589
589
  * @param array Array to search in
@@ -744,7 +744,7 @@ declare function select<Item, FilterCallback extends (item: Item, index: number,
744
744
  * @param mapCallback Callback to map the matched items
745
745
  * @returns Filtered and mapped array of items
746
746
  */
747
- declare function select<Item extends PlainObject, Key extends keyof Item, MapCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], filterKey: Key, filterValue: Item[Key], mapCallback: MapCallback): Array<ReturnType<MapCallback>>;
747
+ declare function select<Item extends PlainObject, ItemKey extends keyof Item, MapCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], filterKey: ItemKey, filterValue: Item[ItemKey], mapCallback: MapCallback): Array<ReturnType<MapCallback>>;
748
748
  /**
749
749
  * Get a filtered and mapped array of items
750
750
  * @param array Array to search in
@@ -778,7 +778,7 @@ declare function select<Item, MapCallback extends (item: Item, index: number, ar
778
778
  * @param value Value to match against
779
779
  * @returns New array with items dropped
780
780
  */
781
- declare function drop<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): Item[];
781
+ declare function drop<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item[];
782
782
  /**
783
783
  * Drop items from the start of an array until they match a value
784
784
  * @param array Original array
@@ -829,7 +829,7 @@ declare function slice<Item>(array: Item[]): Item[];
829
829
  * @param value Value to match against
830
830
  * @returns New array with taken items
831
831
  */
832
- declare function take<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): Item[];
832
+ declare function take<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item[];
833
833
  /**
834
834
  * Take items from the start of an array until they match a value
835
835
  * @param array Original array
@@ -870,11 +870,11 @@ type ArrayComparisonSorter<Item> = {
870
870
  /**
871
871
  * Sorting information for arrays _(using a key)_
872
872
  */
873
- type ArrayKeySorter<Item extends PlainObject, Key extends keyof Item> = {
873
+ type ArrayKeySorter<Item extends PlainObject, ItemKey extends keyof Item> = {
874
874
  /**
875
875
  * Comparator to use when comparing items and values
876
876
  */
877
- compare?: CompareCallback<Item, Item[Key]>;
877
+ compare?: CompareCallback<Item, Item[ItemKey]>;
878
878
  /**
879
879
  * Direction to sort by
880
880
  */
@@ -882,12 +882,12 @@ type ArrayKeySorter<Item extends PlainObject, Key extends keyof Item> = {
882
882
  /**
883
883
  * Key to sort by
884
884
  */
885
- key: Key;
885
+ key: ItemKey;
886
886
  };
887
887
  /**
888
888
  * Sorters based on keys in an object
889
889
  */
890
- type ArrayKeySorters<Item extends PlainObject> = { [Key in keyof Item]: ArrayKeySorter<Item, Key> }[keyof Item];
890
+ type ArrayKeySorters<Item extends PlainObject> = { [ItemKey in keyof Item]: ArrayKeySorter<Item, ItemKey> }[keyof Item];
891
891
  /**
892
892
  * Sorting information for arrays _(using a value callback and built-in comparison)_
893
893
  */
@@ -992,7 +992,7 @@ declare function toSet<Item, Callback extends (item: Item, index: number, array:
992
992
  * @param key Key to use for value
993
993
  * @returns Set of values
994
994
  */
995
- declare function toSet<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key): Set<Item[Key]>;
995
+ declare function toSet<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey): Set<Item[ItemKey]>;
996
996
  /**
997
997
  * Create a Set from an array of items
998
998
  * @param array Array to convert
@@ -1016,7 +1016,7 @@ declare function toggle<Item>(destination: Item[], toggled: Item[], callback: (i
1016
1016
  * @param key Key to find existing item
1017
1017
  * @returns Original array
1018
1018
  */
1019
- declare function toggle<Item extends PlainObject, Key extends keyof Item>(destination: Item[], toggled: Item[], key: Key): Item[];
1019
+ declare function toggle<Item extends PlainObject, ItemKey extends keyof Item>(destination: Item[], toggled: Item[], key: ItemKey): Item[];
1020
1020
  /**
1021
1021
  * Toggle an item in an array: if the item exists, it will be removed; if it doesn't, it will be added
1022
1022
  * @param destination Array to toggle within
@@ -1041,7 +1041,7 @@ declare function union<First, Second>(first: First[], second: Second[], callback
1041
1041
  * @param key Key to get an item's value for comparison
1042
1042
  * @returns Combined, unique values from both arrays
1043
1043
  */
1044
- declare function union<First extends Record<string, unknown>, Second extends Record<string, unknown>, Key extends keyof First & keyof Second>(first: First[], second: Second[], key: Key): (First | Second)[];
1044
+ declare function union<First extends Record<string, unknown>, Second extends Record<string, unknown>, SharedKey extends keyof First & keyof Second>(first: First[], second: Second[], key: SharedKey): (First | Second)[];
1045
1045
  /**
1046
1046
  * Get the combined, unique values from two arrays
1047
1047
  * @param first First array
@@ -1088,7 +1088,7 @@ declare function update<Item>(destination: Item[], updated: Item[], callback: (i
1088
1088
  * @param key Key to find existing item
1089
1089
  * @returns Original array
1090
1090
  */
1091
- declare function update<Item extends PlainObject, Key extends keyof Item>(destination: Item[], updated: Item[], key: Key): Item[];
1091
+ declare function update<Item extends PlainObject, ItemKey extends keyof Item>(destination: Item[], updated: Item[], key: ItemKey): Item[];
1092
1092
  /**
1093
1093
  * Update an item in an array: if the item exists, it will be updated; if it doesn't, it will be added
1094
1094
  * @param destination Array to update within
@@ -1110,7 +1110,7 @@ declare function update<Item>(destination: Item[], updated: Item[]): Item[];
1110
1110
  * @param key Key to get an item's value for matching
1111
1111
  * @returns Original array with items moved _(or unchanged if unable to move)_
1112
1112
  */
1113
- declare function move<Item extends PlainObject, Key extends keyof Item>(array: Item[], from: Item | Item[], to: Item | Item[], key: Key): Item[];
1113
+ declare function move<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], from: Item | Item[], to: Item | Item[], key: ItemKey): Item[];
1114
1114
  /**
1115
1115
  * Move an item _(or array of items)_ to the position of another item _(or array of items)_ within an array
1116
1116
  *
@@ -1160,7 +1160,7 @@ declare function moveIndices<Item>(array: Item[], from: number, to: number): Ite
1160
1160
  * @param key Key to get an item's value for matching
1161
1161
  * @returns Original array with items moved _(or unchanged if unable to move)_
1162
1162
  */
1163
- declare function moveToIndex<Item extends PlainObject, Key extends keyof Item>(array: Item[], value: Item | Item[], index: number, key: Key): Item[];
1163
+ declare function moveToIndex<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], value: Item | Item[], index: number, key: ItemKey): Item[];
1164
1164
  /**
1165
1165
  * Move an item _(or array of items)_ to an index within an array
1166
1166
  *
@@ -1194,7 +1194,7 @@ declare function moveToIndex<Item>(array: Item[], value: Item | Item[], index: n
1194
1194
  * @param key Key to get an item's value for matching
1195
1195
  * @returns Original array with items swapped _(or unchanged if unable to swap)_
1196
1196
  */
1197
- declare function swap<Item extends PlainObject, Key extends keyof Item>(array: Item[], first: Item[], second: Item[], key: Key): Item[];
1197
+ declare function swap<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], first: Item[], second: Item[], key: ItemKey): Item[];
1198
1198
  /**
1199
1199
  * Swap two smaller arrays within a larger array
1200
1200
  *
@@ -1226,7 +1226,7 @@ declare function swap<Item>(array: Item[], first: Item[], second: Item[]): Item[
1226
1226
  * @param key Key to get an item's value for matching
1227
1227
  * @returns Original array with items swapped _(or unchanged if unable to swap)_
1228
1228
  */
1229
- declare function swap<Item extends PlainObject, Key extends keyof Item>(array: Item[], first: Item, second: Item, key: Key): Item[];
1229
+ declare function swap<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], first: Item, second: Item, key: ItemKey): Item[];
1230
1230
  /**
1231
1231
  * Swap two indiced items in an array
1232
1232
  *
@@ -1270,7 +1270,7 @@ declare function swapIndices<Item>(array: Item[], first: number, second: number)
1270
1270
  * @param value Callback to get an item's value
1271
1271
  * @returns Map of keyed values
1272
1272
  */
1273
- declare function toMap<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Map<ReturnType<KeyCallback>, ReturnType<ValueCallback>>;
1273
+ declare function toMap<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Map<ReturnType<KeyCallback>, ReturnType<ValueCallback>>;
1274
1274
  /**
1275
1275
  * Create a Map from an array of items using a callback and value
1276
1276
  *
@@ -1280,7 +1280,7 @@ declare function toMap<Item, KeyCallback extends (item: Item, index: number, arr
1280
1280
  * @param value Key to use for value
1281
1281
  * @returns Map of keyed values
1282
1282
  */
1283
- declare function toMap<Item extends PlainObject, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ItemValue extends keyof Item>(array: Item[], key: KeyCallback, value: ItemValue): Map<ReturnType<KeyCallback>, Item[ItemValue]>;
1283
+ declare function toMap<Item extends PlainObject, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ItemValue extends keyof Item>(array: Item[], key: KeyCallback, value: ItemValue): Map<ReturnType<KeyCallback>, Item[ItemValue]>;
1284
1284
  /**
1285
1285
  * Create a Map from an array of items using a key and callback
1286
1286
  *
@@ -1309,7 +1309,7 @@ declare function toMap<Item extends PlainObject, ItemKey extends keyof Item, Ite
1309
1309
  * @param callback Callback to get an item's grouping key
1310
1310
  * @returns Map of keyed items
1311
1311
  */
1312
- declare function toMap<Item, Callback extends (item: Item, index: number, array: Item[]) => Key$1>(array: Item[], callback: Callback): Map<ReturnType<Callback>, Item>;
1312
+ declare function toMap<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], callback: Callback): Map<ReturnType<Callback>, Item>;
1313
1313
  /**
1314
1314
  * Create a Map from an array of items using a key
1315
1315
  *
@@ -1335,7 +1335,7 @@ declare namespace toMap {
1335
1335
  * @param value Callback to get an item's value
1336
1336
  * @returns Map of keyed arrays of values
1337
1337
  */
1338
- declare function toMapArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Map<ReturnType<KeyCallback>, ReturnType<ValueCallback>[]>;
1338
+ declare function toMapArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Map<ReturnType<KeyCallback>, ReturnType<ValueCallback>[]>;
1339
1339
  /**
1340
1340
  * Create a Map from an array of items using a callback and value, grouping values into arrays
1341
1341
  * @param array Array to convert
@@ -1343,7 +1343,7 @@ declare function toMapArrays<Item, KeyCallback extends (item: Item, index: numbe
1343
1343
  * @param value Key to use for value
1344
1344
  * @returns Map of keyed arrays of values
1345
1345
  */
1346
- declare function toMapArrays<Item extends PlainObject, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ItemValue extends keyof Item>(array: Item[], key: KeyCallback, value: ItemValue): Map<ReturnType<KeyCallback>, Item[ItemValue][]>;
1346
+ declare function toMapArrays<Item extends PlainObject, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ItemValue extends keyof Item>(array: Item[], key: KeyCallback, value: ItemValue): Map<ReturnType<KeyCallback>, Item[ItemValue][]>;
1347
1347
  /**
1348
1348
  * Create a Map from an array of items using a key and callback, grouping values into arrays
1349
1349
  * @param array Array to convert
@@ -1366,7 +1366,7 @@ declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Ite
1366
1366
  * @param callback Callback to get an item's grouping key
1367
1367
  * @returns Map of keyed arrays of items
1368
1368
  */
1369
- declare function toMapArrays<Item, Callback extends (item: Item, index: number, array: Item[]) => Key$1>(array: Item[], callback: Callback): Map<ReturnType<Callback>, Item[]>;
1369
+ declare function toMapArrays<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], callback: Callback): Map<ReturnType<Callback>, Item[]>;
1370
1370
  /**
1371
1371
  * Create a Map from an array of items using a key, grouping items into arrays
1372
1372
  * @param array Array to convert
@@ -1385,7 +1385,7 @@ declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Ite
1385
1385
  * @param value Callback to get an item's value
1386
1386
  * @returns Record of keyed values
1387
1387
  */
1388
- declare function toRecord<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, ReturnType<ValueCallback>>;
1388
+ declare function toRecord<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, ReturnType<ValueCallback>>;
1389
1389
  /**
1390
1390
  * Create a record from an array of items using a callback and value
1391
1391
  *
@@ -1395,7 +1395,7 @@ declare function toRecord<Item, KeyCallback extends (item: Item, index: number,
1395
1395
  * @param value Key to use for value
1396
1396
  * @returns Record with keys
1397
1397
  */
1398
- declare function toRecord<Item extends PlainObject, Callback extends (item: Item, index: number, array: Item[]) => Key$1, ItemValue extends keyof Item>(array: Item[], callback: Callback, value: ItemValue): Record<ReturnType<Callback>, Item[ItemValue]>;
1398
+ declare function toRecord<Item extends PlainObject, Callback extends (item: Item, index: number, array: Item[]) => Key, ItemValue extends keyof Item>(array: Item[], callback: Callback, value: ItemValue): Record<ReturnType<Callback>, Item[ItemValue]>;
1399
1399
  /**
1400
1400
  * Create a record from an array of items using a key and callback
1401
1401
  *
@@ -1424,7 +1424,7 @@ declare function toRecord<Item extends PlainObject, ItemKey extends keyof Item,
1424
1424
  * @param callback Callback to get an item's grouping key
1425
1425
  * @returns Record of keyed values
1426
1426
  */
1427
- declare function toRecord<Item, Callback extends (item: Item, index: number, array: Item[]) => Key$1>(array: Item[], callback: Callback): Record<ReturnType<Callback>, Item>;
1427
+ declare function toRecord<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], callback: Callback): Record<ReturnType<Callback>, Item>;
1428
1428
  /**
1429
1429
  * Create a record from an array of items using a key
1430
1430
  *
@@ -1450,7 +1450,7 @@ declare namespace toRecord {
1450
1450
  * @param value Callback to get an item's value
1451
1451
  * @returns Record of keyed arrays of values
1452
1452
  */
1453
- declare function toRecordArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key$1, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, ReturnType<ValueCallback>[]>;
1453
+ declare function toRecordArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Record<ReturnType<KeyCallback>, ReturnType<ValueCallback>[]>;
1454
1454
  /**
1455
1455
  * Create a record from an array of items using a callback and value, grouping values into arrays
1456
1456
  * @param array Array to convert
@@ -1458,7 +1458,7 @@ declare function toRecordArrays<Item, KeyCallback extends (item: Item, index: nu
1458
1458
  * @param value Key to use for value
1459
1459
  * @returns Record of keyed arrays of values
1460
1460
  */
1461
- declare function toRecordArrays<Item extends PlainObject, Callback extends (item: Item, index: number, array: Item[]) => Key$1, ItemValue extends keyof Item>(array: Item[], callback: Callback, value: ItemValue): Record<ReturnType<Callback>, Item[ItemValue][]>;
1461
+ declare function toRecordArrays<Item extends PlainObject, Callback extends (item: Item, index: number, array: Item[]) => Key, ItemValue extends keyof Item>(array: Item[], callback: Callback, value: ItemValue): Record<ReturnType<Callback>, Item[ItemValue][]>;
1462
1462
  /**
1463
1463
  * Create a record from an array of items using a key and callback, grouping values into arrays
1464
1464
  * @param array Array to convert
@@ -1481,7 +1481,7 @@ declare function toRecordArrays<Item extends PlainObject, ItemKey extends keyof
1481
1481
  * @param callback Callback to get an item's grouping key
1482
1482
  * @returns Record of keyed arrays of items
1483
1483
  */
1484
- declare function toRecordArrays<Item, Callback extends (item: Item, index: number, array: Item[]) => Key$1>(array: Item[], callback: Callback): Record<ReturnType<Callback>, Item[]>;
1484
+ declare function toRecordArrays<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], callback: Callback): Record<ReturnType<Callback>, Item[]>;
1485
1485
  /**
1486
1486
  * Create a record from an array of items using a key, grouping items into arrays
1487
1487
  * @param array Array to convert
@@ -2471,7 +2471,7 @@ declare function diff<First, Second = First>(first: First, second: Second, optio
2471
2471
  * @param keys Keys to omit
2472
2472
  * @returns Partial object without the specified keys
2473
2473
  */
2474
- declare function omit<Value extends PlainObject, Key extends keyof Value>(value: Value, keys: Key[]): Omit<Value, Key>;
2474
+ declare function omit<Value extends PlainObject, ValueKey extends keyof Value>(value: Value, keys: ValueKey[]): Omit<Value, ValueKey>;
2475
2475
  //#endregion
2476
2476
  //#region src/value/pick.d.ts
2477
2477
  /**
@@ -2480,10 +2480,10 @@ declare function omit<Value extends PlainObject, Key extends keyof Value>(value:
2480
2480
  * @param keys Keys to use
2481
2481
  * @returns Partial object with only the specified keys
2482
2482
  */
2483
- declare function pick<Value extends PlainObject, Key extends keyof Value>(value: Value, keys: Key[]): Pick<Value, Key>;
2483
+ declare function pick<Value extends PlainObject, ValueKey extends keyof Value>(value: Value, keys: ValueKey[]): Pick<Value, ValueKey>;
2484
2484
  //#endregion
2485
2485
  //#region src/value/smush.d.ts
2486
- type Smushed<Value extends PlainObject> = Simplify<{ [Key in NestedKeys<Value>]: NestedValue<Value, ToString<Key>> }>;
2486
+ type Smushed<Value extends PlainObject> = Simplify<{ [NestedKey in NestedKeys<Value>]: NestedValue<Value, ToString<NestedKey>> }>;
2487
2487
  /**
2488
2488
  * Smush an object into a flat object that uses dot notation keys
2489
2489
  * @param value Object to smush
@@ -2500,7 +2500,7 @@ type KeysOfUnion<ObjectType> = keyof UnionToIntersection<ObjectType extends unkn
2500
2500
  * Thanks, type-fest!
2501
2501
  */
2502
2502
  type UnionToIntersection<Union> = (Union extends unknown ? (distributedUnion: Union) => void : never) extends ((mergedIntersection: infer Intersection) => void) ? Intersection & Union : never;
2503
- type Unsmushed<Value extends PlainObject> = Simplify<Omit<{ [Key in KeysOfUnion<Value>]: Value[Key] }, `${string}.${string}`>>;
2503
+ type Unsmushed<Value extends PlainObject> = Simplify<Omit<{ [UnionKey in KeysOfUnion<Value>]: Value[UnionKey] }, `${string}.${string}`>>;
2504
2504
  /**
2505
2505
  * Unsmush a smushed object _(turning dot notation keys into nested keys)_
2506
2506
  * @param value Object to unsmush
@@ -2943,7 +2943,7 @@ declare function isInstanceOf<Instance>(constructor: Constructor<Instance>, valu
2943
2943
  * @param value Value to check
2944
2944
  * @returns `true` if the value is a `Key` _(`number` or `string`)_, otherwise `false`
2945
2945
  */
2946
- declare function isKey(value: unknown): value is Key$1;
2946
+ declare function isKey(value: unknown): value is Key;
2947
2947
  /**
2948
2948
  * Is the value a number?
2949
2949
  * @param value Value to check
@@ -3093,7 +3093,7 @@ declare function max<Item>(items: Item[], callback: (item: Item, index: number,
3093
3093
  * @param key Key to use for value
3094
3094
  * @returns Maximum value, or `NaN` if no maximum can be found
3095
3095
  */
3096
- declare function max<Item extends PlainObject, Key extends keyof NumericalValues<Item>>(items: Item[], key: Key): number;
3096
+ declare function max<Item extends PlainObject, ItemKey extends keyof NumericalValues<Item>>(items: Item[], key: ItemKey): number;
3097
3097
  /**
3098
3098
  * Get the maximum value from a list of numbers
3099
3099
  * @param values List of numbers
@@ -3144,7 +3144,7 @@ declare function count<Item>(array: Item[], callback: (item: Item, index: number
3144
3144
  * @param value Value to match and count
3145
3145
  * @returns Number of items with the specified key value, or `NaN` if no count can be calculated
3146
3146
  */
3147
- declare function count<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): number;
3147
+ declare function count<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): number;
3148
3148
  /**
3149
3149
  * Count the number of items in an array
3150
3150
  * @param values Array to count for
@@ -3265,6 +3265,14 @@ type FulfilledPromise<Value> = {
3265
3265
  status: typeof PROMISE_TYPE_FULFILLED;
3266
3266
  value: Awaited<Value>;
3267
3267
  };
3268
+ type PromiseData = {
3269
+ last: number;
3270
+ result: unknown[];
3271
+ };
3272
+ type PromiseHandlers = {
3273
+ resolve: (value: unknown[]) => void;
3274
+ reject: (reason: unknown) => void;
3275
+ };
3268
3276
  type PromiseOptions = {
3269
3277
  /**
3270
3278
  * AbortSignal for aborting the promise; when aborted, the promise will reject with the reason of the signal
@@ -3275,6 +3283,15 @@ type PromiseOptions = {
3275
3283
  */
3276
3284
  time?: number;
3277
3285
  };
3286
+ type PromiseParameters = {
3287
+ abort: () => void;
3288
+ complete: boolean;
3289
+ data: PromiseData;
3290
+ handlers: PromiseHandlers;
3291
+ index: number;
3292
+ signal?: AbortSignal;
3293
+ value?: unknown;
3294
+ };
3278
3295
  /**
3279
3296
  * Promise handling strategy
3280
3297
  *
@@ -3287,73 +3304,33 @@ type PromiseStrategy = 'complete' | 'first';
3287
3304
  declare class PromiseTimeoutError extends Error {
3288
3305
  constructor();
3289
3306
  }
3290
- type PromisesItems<Items extends unknown[]> = { [Key in keyof Items]: Items[Key] extends GenericCallback ? ReturnType<Items[Key]> extends Promise<infer Value> ? Promise<Value> : never : Items[Key] extends Promise<infer Value> ? Promise<Value> : Promise<Items[Key]> };
3307
+ type PromisesItems<Items extends unknown[]> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends GenericCallback ? ReturnType<Items[ItemsKey]> extends Promise<infer Value> ? Promise<Value> : never : Items[ItemsKey] extends Promise<infer Value> ? Promise<Value> : Promise<Items[ItemsKey]> };
3291
3308
  type PromisesOptions = {
3292
3309
  signal?: AbortSignal;
3293
3310
  strategy?: PromiseStrategy;
3294
3311
  };
3295
- type PromisesResult<Items extends unknown[]> = { [Key in keyof Items]: Items[Key] extends Promise<infer Value> ? Result<Awaited<Value>> : never };
3296
- type PromisesUnwrapped<Items extends unknown[]> = { [Key in keyof Items]: Items[Key] extends GenericCallback ? ReturnType<Items[Key]> extends Promise<infer Value> ? Awaited<Value> : never : Items[Key] extends Promise<infer Value> ? Awaited<Value> : never };
3312
+ type PromisesResult<Items extends unknown[]> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends Promise<infer Value> ? Result<Awaited<Value>> : never };
3313
+ type PromisesUnwrapped<Items extends unknown[]> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends GenericCallback ? ReturnType<Items[ItemsKey]> extends Promise<infer Value> ? Awaited<Value> : never : Items[ItemsKey] extends Promise<infer Value> ? Awaited<Value> : never };
3297
3314
  type PromisesValue<Value> = FulfilledPromise<Value> | RejectedPromise;
3298
- type PromisesValues<Items extends unknown[]> = { [Key in keyof Items]: Items[Key] extends GenericCallback ? ReturnType<Items[Key]> extends Promise<infer Value> ? PromisesValue<Awaited<Value>> : never : Items[Key] extends Promise<infer Value> ? PromisesValue<Awaited<Value>> : never };
3315
+ type PromisesValues<Items extends unknown[]> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends GenericCallback ? ReturnType<Items[ItemsKey]> extends Promise<infer Value> ? PromisesValue<Awaited<Value>> : never : Items[ItemsKey] extends Promise<infer Value> ? PromisesValue<Awaited<Value>> : never };
3299
3316
  type RejectedPromise = {
3300
3317
  status: typeof PROMISE_TYPE_REJECTED;
3301
3318
  reason: unknown;
3302
3319
  };
3320
+ declare const PROMISE_ABORT_EVENT = "abort";
3321
+ declare const PROMISE_ABORT_OPTIONS: {
3322
+ once: boolean;
3323
+ };
3324
+ declare const PROMISE_ERROR_NAME = "PromiseTimeoutError";
3325
+ declare const PROMISE_MESSAGE_EXPECTATION_ATTEMPT = "Attempt expected a function or a promise";
3326
+ declare const PROMISE_MESSAGE_EXPECTATION_RESULT = "toResult expected a Promise";
3327
+ declare const PROMISE_MESSAGE_EXPECTATION_TIMED = "Timed function expected a Promise";
3328
+ declare const PROMISE_MESSAGE_TIMEOUT = "Promise timed out";
3329
+ declare const PROMISE_STRATEGY_ALL: Set<PromiseStrategy>;
3330
+ declare const PROMISE_STRATEGY_DEFAULT: PromiseStrategy;
3303
3331
  declare const PROMISE_TYPE_FULFILLED = "fulfilled";
3304
3332
  declare const PROMISE_TYPE_REJECTED = "rejected";
3305
3333
  //#endregion
3306
- //#region src/result/misc.d.ts
3307
- /**
3308
- * Creates an extended error result
3309
- * @param error Error value
3310
- * @param original Original error
3311
- * @returns Error result
3312
- */
3313
- declare function error<E>(value: E, original: Error): ExtendedErr<E>;
3314
- /**
3315
- * Creates an error result
3316
- * @param error Error value
3317
- * @returns Error result
3318
- */
3319
- declare function error<E>(value: E): Err<E>;
3320
- /**
3321
- * Creates an ok result
3322
- * @param value Value
3323
- * @returns Ok result
3324
- */
3325
- declare function ok<Value>(value: Value): Ok<Value>;
3326
- /**
3327
- * Converts a result to a promise
3328
- *
3329
- * Resolves if ok, rejects for error
3330
- * @param result Result to convert
3331
- * @returns Promised result
3332
- */
3333
- declare function toPromise<Value, E = Error>(callback: () => AnyResult<Value, E>): Promise<Value>;
3334
- /**
3335
- * Converts a result to a promise
3336
- *
3337
- * Resolves if ok, rejects for error
3338
- * @param result Result to convert
3339
- * @returns Promised result
3340
- */
3341
- declare function toPromise<Value, E = Error>(result: AnyResult<Value, E>): Promise<Value>;
3342
- /**
3343
- * Gets the value of an ok result _(or a default value)_
3344
- * @param value Result to unwrap
3345
- * @param defaultValue Default value
3346
- * @returns Value of the result _(or the default value)_
3347
- */
3348
- declare function unwrap<Value, E = Error>(value: Result<Value, E>, defaultValue: Value): Value;
3349
- /**
3350
- * Gets the value of an ok result _(or a default value)_
3351
- * @param value Result to unwrap
3352
- * @param defaultValue Default value
3353
- * @returns Value of the result _(or the default value)_
3354
- */
3355
- declare function unwrap(value: unknown, defaultValue: unknown): unknown;
3356
- //#endregion
3357
3334
  //#region src/promise/delay.d.ts
3358
3335
  /**
3359
3336
  * Create a delayed promise that resolves after a certain amount of time, or rejects if aborted
@@ -3368,56 +3345,6 @@ declare function delay(options?: PromiseOptions): Promise<void>;
3368
3345
  */
3369
3346
  declare function delay(time?: number): Promise<void>;
3370
3347
  //#endregion
3371
- //#region src/promise/helpers.d.ts
3372
- /**
3373
- * Is the value a fulfilled promise result?
3374
- * @param value Value to check
3375
- * @returns `true` if the value is a fulfilled promise result, `false` otherwise
3376
- */
3377
- declare function isFulfilled<Value>(value: unknown): value is FulfilledPromise<Value>;
3378
- /**
3379
- * Is the value a rejected promise result?
3380
- * @param value Value to check
3381
- * @returns `true` if the value is a rejected promise result, `false` otherwise
3382
- */
3383
- declare function isRejected(value: unknown): value is RejectedPromise;
3384
- //#endregion
3385
- //#region src/promise/misc.d.ts
3386
- /**
3387
- * Create a cancelable promise
3388
- * @param executor Executor function for the promise
3389
- * @returns Cancelable promise
3390
- */
3391
- declare function cancelable<Value>(executor: (resolve: (value: Value) => void, reject: (reason: unknown) => void) => void): CancelablePromise<Value>;
3392
- /**
3393
- * Converts a promise to a promised result
3394
- * @param callback Promise callback
3395
- * @returns Promised result
3396
- */
3397
- declare function toResult<Value>(callback: () => Promise<Value>): Promise<Result<Value>>;
3398
- /**
3399
- * Converts a promise to a promised result
3400
- * @param promise Promise to convert
3401
- * @returns Promised result
3402
- */
3403
- declare function toResult<Value>(promise: Promise<Value>): Promise<Result<Value>>;
3404
- //#endregion
3405
- //#region src/promise/timed.d.ts
3406
- /**
3407
- * Create a promise that should be settled within a certain amount of time
3408
- * @param promise Promise to settle
3409
- * @param options Timed options
3410
- * @returns Timed promise
3411
- */
3412
- declare function timed<Value>(promise: Promise<Value>, options: RequiredKeys<PromiseOptions, 'time'>): Promise<Value>;
3413
- /**
3414
- * Create a promise that should be settled within a certain amount of time
3415
- * @param promise Promise to settle
3416
- * @param time How long to wait for _(in milliseconds; defaults to `0`)_
3417
- * @returns Timed promise
3418
- */
3419
- declare function timed<Value>(promise: Promise<Value>, time: number): Promise<Value>;
3420
- //#endregion
3421
3348
  //#region src/promise/index.d.ts
3422
3349
  /**
3423
3350
  * Wrap a promise with safety handlers, with optional abort capabilities and timeout
@@ -3512,6 +3439,149 @@ declare function resultPromises<Items extends unknown[]>(items: [...Items], sign
3512
3439
  */
3513
3440
  declare function resultPromises<Value>(items: Promise<Value>[], signal?: AbortSignal): Promise<Result<Awaited<Value>>[]>;
3514
3441
  //#endregion
3442
+ //#region src/internal/result.d.ts
3443
+ /**
3444
+ * Is the result an extended error?
3445
+ * @param result Result to check
3446
+ * @returns `true` if the result is an extended error, `false` otherwise
3447
+ */
3448
+ declare function isError<Value, E = Error>(value: ExtendedErr<E> | Result<Value, E>, extended: true): value is ExtendedErr<E>;
3449
+ /**
3450
+ * Is the result an error?
3451
+ * @param result Result to check
3452
+ * @returns `true` if the result is an error, `false` otherwise
3453
+ */
3454
+ declare function isError<Value, E = Error>(value: Result<Value, E>): value is Err<E>;
3455
+ /**
3456
+ * Is the value an error?
3457
+ * @param value Value to check
3458
+ * @returns `true` if the value is an error, `false` otherwise
3459
+ */
3460
+ declare function isError(value: unknown): value is Err<unknown> | ExtendedErr<unknown>;
3461
+ /**
3462
+ * Is the result ok?
3463
+ * @param value Result to check
3464
+ * @returns `true` if the result is ok, `false` otherwise
3465
+ */
3466
+ declare function isOk<Value, E = Error>(value: Result<Value, E>): value is Ok<Value>;
3467
+ /**
3468
+ * Is the value ok?
3469
+ * @param value Value to check
3470
+ * @returns `true` if the value is ok, `false` otherwise
3471
+ */
3472
+ declare function isOk(value: unknown): value is Ok<unknown>;
3473
+ /**
3474
+ * Is the value a result?
3475
+ * @param value Value to check
3476
+ * @returns `true` if the value is a result, `false` otherwise
3477
+ */
3478
+ declare function isResult(value: unknown): value is ExtendedErr<unknown> | Result<unknown, unknown>;
3479
+ //#endregion
3480
+ //#region src/result/misc.d.ts
3481
+ /**
3482
+ * Creates an extended error result
3483
+ * @param error Error value
3484
+ * @param original Original error
3485
+ * @returns Error result
3486
+ */
3487
+ declare function error<E>(value: E, original: Error): ExtendedErr<E>;
3488
+ /**
3489
+ * Creates an error result
3490
+ * @param error Error value
3491
+ * @returns Error result
3492
+ */
3493
+ declare function error<E>(value: E): Err<E>;
3494
+ declare function getError<E>(value: E, original?: Error): Err<E> | ExtendedErr<E>;
3495
+ /**
3496
+ * Creates an ok result
3497
+ * @param value Value
3498
+ * @returns Ok result
3499
+ */
3500
+ declare function ok<Value>(value: Value): Ok<Value>;
3501
+ /**
3502
+ * Converts a result to a promise
3503
+ *
3504
+ * Resolves if ok, rejects for error
3505
+ * @param result Result to convert
3506
+ * @returns Promised result
3507
+ */
3508
+ declare function toPromise<Value, E = Error>(callback: () => AnyResult<Value, E>): Promise<Value>;
3509
+ /**
3510
+ * Converts a result to a promise
3511
+ *
3512
+ * Resolves if ok, rejects for error
3513
+ * @param result Result to convert
3514
+ * @returns Promised result
3515
+ */
3516
+ declare function toPromise<Value, E = Error>(result: AnyResult<Value, E>): Promise<Value>;
3517
+ /**
3518
+ * Gets the value of an ok result _(or a default value)_
3519
+ * @param value Result to unwrap
3520
+ * @param defaultValue Default value
3521
+ * @returns Value of the result _(or the default value)_
3522
+ */
3523
+ declare function unwrap<Value, E = Error>(value: Result<Value, E>, defaultValue: Value): Value;
3524
+ /**
3525
+ * Gets the value of an ok result _(or a default value)_
3526
+ * @param value Result to unwrap
3527
+ * @param defaultValue Default value
3528
+ * @returns Value of the result _(or the default value)_
3529
+ */
3530
+ declare function unwrap(value: unknown, defaultValue: unknown): unknown;
3531
+ //#endregion
3532
+ //#region src/promise/helpers.d.ts
3533
+ /**
3534
+ * Is the value a fulfilled promise result?
3535
+ * @param value Value to check
3536
+ * @returns `true` if the value is a fulfilled promise result, `false` otherwise
3537
+ */
3538
+ declare function isFulfilled<Value>(value: unknown): value is FulfilledPromise<Value>;
3539
+ /**
3540
+ * Is the value a rejected promise result?
3541
+ * @param value Value to check
3542
+ * @returns `true` if the value is a rejected promise result, `false` otherwise
3543
+ */
3544
+ declare function isRejected(value: unknown): value is RejectedPromise;
3545
+ //#endregion
3546
+ //#region src/promise/misc.d.ts
3547
+ /**
3548
+ * Create a cancelable promise
3549
+ * @param executor Executor function for the promise
3550
+ * @returns Cancelable promise
3551
+ */
3552
+ declare function cancelable<Value>(executor: (resolve: (value: Value) => void, reject: (reason: unknown) => void) => void): CancelablePromise<Value>;
3553
+ declare function handleResult(status: string, parameters: PromiseParameters): void;
3554
+ declare function settlePromise(aborter: () => void, settler: (value: any) => void, value: unknown, signal?: AbortSignal): void;
3555
+ /**
3556
+ * Converts a promise to a promised result
3557
+ * @param callback Promise callback
3558
+ * @returns Promised result
3559
+ */
3560
+ declare function toResult<Value>(callback: () => Promise<Value>): Promise<Result<Value>>;
3561
+ /**
3562
+ * Converts a promise to a promised result
3563
+ * @param promise Promise to convert
3564
+ * @returns Promised result
3565
+ */
3566
+ declare function toResult<Value>(promise: Promise<Value>): Promise<Result<Value>>;
3567
+ //#endregion
3568
+ //#region src/promise/timed.d.ts
3569
+ declare function getTimedPromise<Value>(promise: Promise<Value>, time: number, signal?: AbortSignal): Promise<Value>;
3570
+ /**
3571
+ * Create a promise that should be settled within a certain amount of time
3572
+ * @param promise Promise to settle
3573
+ * @param options Timed options
3574
+ * @returns Timed promise
3575
+ */
3576
+ declare function timed<Value>(promise: Promise<Value>, options: RequiredKeys<PromiseOptions, 'time'>): Promise<Value>;
3577
+ /**
3578
+ * Create a promise that should be settled within a certain amount of time
3579
+ * @param promise Promise to settle
3580
+ * @param time How long to wait for _(in milliseconds; defaults to `0`)_
3581
+ * @returns Timed promise
3582
+ */
3583
+ declare function timed<Value>(promise: Promise<Value>, time: number): Promise<Value>;
3584
+ //#endregion
3515
3585
  //#region src/query.d.ts
3516
3586
  /**
3517
3587
  * Convert a query string to a plain _(nested)_ object
@@ -4120,44 +4190,6 @@ declare namespace attemptPipe {
4120
4190
  var async: typeof attemptAsyncPipe;
4121
4191
  }
4122
4192
  //#endregion
4123
- //#region src/internal/result.d.ts
4124
- /**
4125
- * Is the result an extended error?
4126
- * @param result Result to check
4127
- * @returns `true` if the result is an extended error, `false` otherwise
4128
- */
4129
- declare function isError<Value, E = Error>(value: ExtendedErr<E> | Result<Value, E>, extended: true): value is ExtendedErr<E>;
4130
- /**
4131
- * Is the result an error?
4132
- * @param result Result to check
4133
- * @returns `true` if the result is an error, `false` otherwise
4134
- */
4135
- declare function isError<Value, E = Error>(value: Result<Value, E>): value is Err<E>;
4136
- /**
4137
- * Is the value an error?
4138
- * @param value Value to check
4139
- * @returns `true` if the value is an error, `false` otherwise
4140
- */
4141
- declare function isError(value: unknown): value is Err<unknown> | ExtendedErr<unknown>;
4142
- /**
4143
- * Is the result ok?
4144
- * @param value Result to check
4145
- * @returns `true` if the result is ok, `false` otherwise
4146
- */
4147
- declare function isOk<Value, E = Error>(value: Result<Value, E>): value is Ok<Value>;
4148
- /**
4149
- * Is the value ok?
4150
- * @param value Value to check
4151
- * @returns `true` if the value is ok, `false` otherwise
4152
- */
4153
- declare function isOk(value: unknown): value is Ok<unknown>;
4154
- /**
4155
- * Is the value a result?
4156
- * @param value Value to check
4157
- * @returns `true` if the value is a result, `false` otherwise
4158
- */
4159
- declare function isResult(value: unknown): value is ExtendedErr<unknown> | Result<unknown, unknown>;
4160
- //#endregion
4161
4193
  //#region src/result/index.d.ts
4162
4194
  /**
4163
4195
  * Executes a promise, catching any errors, and returns a result
@@ -4212,7 +4244,7 @@ declare namespace attempt {
4212
4244
  *
4213
4245
  * Behavior is similar to a _LRU_-cache, where the least recently used entries are removed
4214
4246
  */
4215
- declare class SizedMap<Key = unknown, Value = unknown> extends Map<Key, Value> {
4247
+ declare class SizedMap<SizedKey = unknown, SizedValue = unknown> extends Map<SizedKey, SizedValue> {
4216
4248
  #private;
4217
4249
  /**
4218
4250
  * Is the Map full?
@@ -4222,33 +4254,33 @@ declare class SizedMap<Key = unknown, Value = unknown> extends Map<Key, Value> {
4222
4254
  /**
4223
4255
  * Create a new SizedMap with entries and a maximum size _(2^20)_
4224
4256
  * @param entries Array of key-value pairs to initialize the SizedMap with
4225
- * @template Key Type of the keys in the SizedMap
4226
- * @template Value Type of the values in the SizedMap
4257
+ * @template SizedKey Type of the keys in the SizedMap
4258
+ * @template SizedValue Type of the values in the SizedMap
4227
4259
  */
4228
- constructor(entries: [Key, Value][]);
4260
+ constructor(entries: [SizedKey, SizedValue][]);
4229
4261
  /**
4230
4262
  * Create a new SizedMap with a maximum size _(but clamped at 2^24)_
4231
4263
  * @param maximum Maximum size of the SizedMap
4232
- * @template Key Type of the keys in the SizedMap
4233
- * @template Value Type of the values in the SizedMap
4264
+ * @template SizedKey Type of the keys in the SizedMap
4265
+ * @template SizedValue Type of the values in the SizedMap
4234
4266
  */
4235
4267
  constructor(maximum: number);
4236
4268
  /**
4237
4269
  * Create a new SizedMap with _(optional)_ entries and a maximum size _(defaults to 2^20; clamped at 2^24)_
4238
4270
  * @param entries Array of key-value pairs to initialize the SizedMap with
4239
4271
  * @param maximum Maximum size of the SizedMap
4240
- * @template Key Type of the keys in the SizedMap
4241
- * @template Value Type of the values in the SizedMap
4272
+ * @template SizedKey Type of the keys in the SizedMap
4273
+ * @template SizedValue Type of the values in the SizedMap
4242
4274
  */
4243
- constructor(entries?: [Key, Value][], maximum?: number);
4275
+ constructor(entries?: [SizedKey, SizedValue][], maximum?: number);
4244
4276
  /**
4245
4277
  * @inheritdoc
4246
4278
  */
4247
- get(key: Key): Value | undefined;
4279
+ get(key: SizedKey): SizedValue | undefined;
4248
4280
  /**
4249
4281
  * @inheritdoc
4250
4282
  */
4251
- set(key: Key, value: Value): this;
4283
+ set(key: SizedKey, value: SizedValue): this;
4252
4284
  }
4253
4285
  //#endregion
4254
4286
  //#region src/sized/set.d.ts
@@ -4295,4 +4327,4 @@ declare class SizedSet<Value = unknown> extends Set<Value> {
4295
4327
  get(value: Value, update?: boolean): Value | undefined;
4296
4328
  }
4297
4329
  //#endregion
4298
- export { ArrayComparisonSorter, ArrayKeySorter, ArrayOrPlainObject, ArrayPosition, ArrayValueSorter, Asserter, type Beacon, type BeaconOptions, BuiltIns, CancelableCallback, CancelablePromise, type Color, Constructor, DiffOptions, DiffResult, DiffValue, EqualOptions, type Err, EventPosition, type ExtendedErr, type ExtendedResult, Flow, FlowPromise, type FulfilledPromise, GenericAsyncCallback, GenericCallback, type HSLAColor, type HSLColor, HasValue, Key$1 as Key, KeyedValue, type Logger, type Memoized, type MemoizedOptions, MergeOptions, Merger, NestedArray, NestedKeys, NestedPartial, NestedValue, NestedValues, NumericalKeys, NumericalValues, type Observable, type Observer, type Ok, OnceAsyncCallback, OnceCallback, PlainObject, Primitive, type PromiseOptions, type PromiseStrategy, PromiseTimeoutError, type PromisesOptions, type PromisesResult, type PromisesValues as PromisesValue, type PromisesValue as PromisesValueItem, type Queue, QueueError, type QueueOptions, type Queued, type RGBAColor, type RGBColor, type RejectedPromise, RequiredKeys, type Result, RetryError, RetryOptions, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, Simplify, SizedMap, SizedSet, Smushed, SortDirection, type Subscription, TemplateOptions, type Time, ToString, TypedArray, Unsmushed, assert, attempt, attemptPromise, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, count, debounce, delay, diff, difference, drop, endsWith, endsWithArray, equal, error, exists, filter, find, flatten, floor, flow, toResult as fromPromise, toResult, fromQuery, toPromise as fromResult, toPromise, getArray, getArrayPosition, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getString, getUuid, getValue, groupBy, hasValue, hexToHsl, hexToHsla, hexToRgb, hexToRgba, hslToHex, hslToRgb, hslToRgba, ignoreKey, includes, includesArray, indexOf, indexOfArray, insert, intersection, isArrayOrPlainObject, isColor, isConstructor, isEmpty, isError, isFulfilled, isHexColor, isHslColor, isHslLike, isHslaColor, isInstanceOf, isKey, isNonNullable, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isOk, isPlainObject, isPrimitive, isRejected, isResult, isRgbColor, isRgbLike, isRgbaColor, isTypedArray, join, kebabCase, logger, lowerCase, max, median, memoize, merge, min, move, noop, ok, omit, once, parse, partition, pascalCase, pick, pipe, promises, push, queue, range, retry, rgbToHex, rgbToHsl, rgbToHsla, round, select, setValue, shuffle, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toQuery, toRecord, toSet, toggle, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };
4330
+ export { AnyResult, ArrayComparisonSorter, ArrayKeySorter, ArrayOrPlainObject, ArrayPosition, ArrayValueSorter, Asserter, AttemptFlow, AttemptFlowPromise, type Beacon, type BeaconOptions, BuiltIns, CancelableCallback, CancelablePromise, type Color, Constructor, DiffOptions, DiffResult, DiffValue, EqualOptions, Err, EventPosition, ExtendedErr, ExtendedResult, Flow, FlowPromise, FulfilledPromise, GenericAsyncCallback, GenericCallback, type HSLAColor, type HSLColor, HasValue, Key, KeyedValue, type Logger, type Memoized, type MemoizedOptions, MergeOptions, Merger, NestedArray, NestedKeys, NestedPartial, NestedValue, NestedValues, NumericalKeys, NumericalValues, type Observable, type Observer, Ok, OnceAsyncCallback, OnceCallback, PROMISE_ABORT_EVENT, PROMISE_ABORT_OPTIONS, PROMISE_ERROR_NAME, PROMISE_MESSAGE_EXPECTATION_ATTEMPT, PROMISE_MESSAGE_EXPECTATION_RESULT, PROMISE_MESSAGE_EXPECTATION_TIMED, PROMISE_MESSAGE_TIMEOUT, PROMISE_STRATEGY_ALL, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED, PlainObject, Primitive, PromiseData, PromiseHandlers, PromiseOptions, PromiseParameters, PromiseStrategy, PromiseTimeoutError, PromisesItems, PromisesOptions, PromisesResult, PromisesUnwrapped, PromisesValue, PromisesValues, type Queue, QueueError, type QueueOptions, type Queued, type RGBAColor, type RGBColor, RejectedPromise, RequiredKeys, Result, ResultMatch, RetryError, RetryOptions, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, Simplify, SizedMap, SizedSet, Smushed, SortDirection, type Subscription, TemplateOptions, type Time, ToString, TypedArray, Unsmushed, UnwrapValue, assert, attempt, attemptFlow, attemptPipe, attemptPromise, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, count, debounce, delay, diff, difference, drop, endsWith, endsWithArray, equal, error, exists, filter, find, flatten, floor, flow, fromQuery, toPromise as fromResult, toPromise, getArray, getArrayPosition, getColor, getError, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getString, getTimedPromise, getUuid, getValue, groupBy, handleResult, hasValue, hexToHsl, hexToHsla, hexToRgb, hexToRgba, hslToHex, hslToRgb, hslToRgba, ignoreKey, includes, includesArray, indexOf, indexOfArray, insert, intersection, isArrayOrPlainObject, isColor, isConstructor, isEmpty, isError, isFulfilled, isHexColor, isHslColor, isHslLike, isHslaColor, isInstanceOf, isKey, isNonNullable, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isOk, isPlainObject, isPrimitive, isRejected, isResult, isRgbColor, isRgbLike, isRgbaColor, isTypedArray, join, kebabCase, logger, lowerCase, matchResult, max, median, memoize, merge, min, move, noop, ok, omit, once, parse, partition, pascalCase, pick, pipe, promises, push, queue, range, retry, rgbToHex, rgbToHsl, rgbToHsla, round, select, setValue, settlePromise, shuffle, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toQuery, toRecord, toResult, toSet, toggle, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };