@oscarpalmer/atoms 0.76.0 → 0.77.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 (59) hide show
  1. package/dist/js/array/count.cjs +1 -8
  2. package/dist/js/array/count.js +1 -8
  3. package/dist/js/array/exists.cjs +1 -8
  4. package/dist/js/array/exists.js +1 -8
  5. package/dist/js/array/filter.cjs +1 -8
  6. package/dist/js/array/filter.js +1 -8
  7. package/dist/js/array/find.cjs +1 -8
  8. package/dist/js/array/find.js +1 -8
  9. package/dist/js/array/index-of.cjs +1 -8
  10. package/dist/js/array/index-of.js +1 -8
  11. package/dist/js/array/unique.cjs +1 -1
  12. package/dist/js/array/unique.js +1 -1
  13. package/dist/js/internal/array/find.cjs +12 -2
  14. package/dist/js/internal/array/find.js +12 -2
  15. package/package.json +11 -4
  16. package/src/js/array/count.ts +7 -20
  17. package/src/js/array/exists.ts +7 -22
  18. package/src/js/array/filter.ts +7 -20
  19. package/src/js/array/find.ts +7 -20
  20. package/src/js/array/group-by.ts +19 -21
  21. package/src/js/array/index-of.ts +7 -20
  22. package/src/js/array/models.ts +2 -16
  23. package/src/js/array/sort.ts +3 -7
  24. package/src/js/array/to-map.ts +19 -21
  25. package/src/js/array/to-record.ts +17 -19
  26. package/src/js/array/unique.ts +8 -8
  27. package/src/js/internal/array/callbacks.ts +4 -4
  28. package/src/js/internal/array/find.ts +29 -6
  29. package/types/array/count.d.cts +2 -5
  30. package/types/array/count.d.ts +3 -3
  31. package/types/array/exists.d.cts +2 -5
  32. package/types/array/exists.d.ts +3 -3
  33. package/types/array/filter.d.cts +2 -5
  34. package/types/array/filter.d.ts +3 -3
  35. package/types/array/find.d.cts +2 -5
  36. package/types/array/find.d.ts +3 -3
  37. package/types/array/group-by.d.cts +8 -11
  38. package/types/array/group-by.d.ts +10 -11
  39. package/types/array/index-of.d.cts +2 -5
  40. package/types/array/index-of.d.ts +3 -3
  41. package/types/array/index.d.cts +43 -48
  42. package/types/array/models.d.cts +2 -7
  43. package/types/array/models.d.ts +2 -7
  44. package/types/array/sort.d.cts +3 -4
  45. package/types/array/sort.d.ts +3 -3
  46. package/types/array/to-map.d.cts +8 -11
  47. package/types/array/to-map.d.ts +9 -10
  48. package/types/array/to-record.d.cts +8 -11
  49. package/types/array/to-record.d.ts +9 -10
  50. package/types/array/unique.d.cts +3 -5
  51. package/types/array/unique.d.ts +4 -4
  52. package/types/index.d.cts +321 -1019
  53. package/types/internal/array/find.d.cts +2 -2
  54. package/types/internal/array/find.d.ts +2 -2
  55. package/types/models.d.cts +210 -467
  56. package/types/value/get.d.cts +210 -469
  57. package/types/value/index.d.cts +223 -514
  58. package/types/value/set.d.cts +169 -356
  59. package/types/value/smush.d.cts +209 -463
@@ -1,9 +1,6 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
3
  export type Key = number | string;
4
- export type ArrayCallback<Item, Value> = (item: Item, index: number, array: Item[]) => Value;
5
- export type BooleanCallback<Item> = ArrayCallback<Item, boolean>;
6
- export type KeyCallback<Item> = ArrayCallback<Item, Key>;
7
4
  /**
8
5
  * Get the index for the first item matching `value` _(or `-1` if no match is found)_
9
6
  */
@@ -11,7 +8,7 @@ export declare function indexOf<Item>(array: Item[], value: Item): number;
11
8
  /**
12
9
  * Get the index for the first item matching `value` _(or `-1` if no match is found)_
13
10
  */
14
- export declare function indexOf<Item>(array: Item[], matches: BooleanCallback<Item>): number;
11
+ export declare function indexOf<Item>(array: Item[], matches: (item: Item, index: number, array: Item[]) => boolean): number;
15
12
  /**
16
13
  * - Get the index for the first matching item _(or `-1` if no match is found)_
17
14
  * - Use `key` to find a comparison value to match with `value`
@@ -21,6 +18,6 @@ export declare function indexOf<Item, Key extends keyof Item>(array: Item[], key
21
18
  * - Get the index for the first matching item _(or `-1` if no match is found)_
22
19
  * - Use `key` to find a comparison value to match with `value`
23
20
  */
24
- export declare function indexOf<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key, value: ReturnType<Key>): number;
21
+ export declare function indexOf<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key, value: ReturnType<Key>): number;
25
22
 
26
23
  export {};
@@ -1,4 +1,4 @@
1
- import type { BooleanCallback, KeyCallback } from '~/array/models';
1
+ import type { Key as SimpleKey } from '~/models';
2
2
  /**
3
3
  * Get the index for the first item matching `value` _(or `-1` if no match is found)_
4
4
  */
@@ -6,7 +6,7 @@ export declare function indexOf<Item>(array: Item[], value: Item): number;
6
6
  /**
7
7
  * Get the index for the first item matching `value` _(or `-1` if no match is found)_
8
8
  */
9
- export declare function indexOf<Item>(array: Item[], matches: BooleanCallback<Item>): number;
9
+ export declare function indexOf<Item>(array: Item[], matches: (item: Item, index: number, array: Item[]) => boolean): number;
10
10
  /**
11
11
  * - Get the index for the first matching item _(or `-1` if no match is found)_
12
12
  * - Use `key` to find a comparison value to match with `value`
@@ -16,4 +16,4 @@ export declare function indexOf<Item, Key extends keyof Item>(array: Item[], key
16
16
  * - Get the index for the first matching item _(or `-1` if no match is found)_
17
17
  * - Use `key` to find a comparison value to match with `value`
18
18
  */
19
- export declare function indexOf<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key, value: ReturnType<Key>): number;
19
+ export declare function indexOf<Item, Key extends (item: Item, index: number, array: Item[]) => SimpleKey>(array: Item[], key: Key, value: ReturnType<Key>): number;
@@ -15,15 +15,6 @@ export declare function compact<Item>(array: Item[]): Exclude<Item, null | undef
15
15
  * Compact an array _(removing all falsey values)_
16
16
  */
17
17
  export declare function compact<Item>(array: Item[], strict: true): Exclude<Item, 0 | "" | false | null | undefined>[];
18
- export type ArrayCallback<Item, Value> = (item: Item, index: number, array: Item[]) => Value;
19
- export type BooleanCallback<Item> = ArrayCallback<Item, boolean>;
20
- export type KeyCallback<Item> = ArrayCallback<Item, Key>;
21
- export type SortKey<Item> = {
22
- direction: "asc" | "desc";
23
- value: Key | SortKeyCallback<Item>;
24
- };
25
- export type SortKeyCallback<Item> = (item: Item) => unknown;
26
- export type ValueCallback<Item> = ArrayCallback<Item, unknown>;
27
18
  /**
28
19
  * Get the number of items _(count)_ that match the given value
29
20
  */
@@ -31,7 +22,7 @@ export declare function count<Item>(array: Item[], value: Item): number;
31
22
  /**
32
23
  * Get the number of items _(count)_ that match the given value
33
24
  */
34
- export declare function count<Item>(array: Item[], matches: BooleanCallback<Item>): number;
25
+ export declare function count<Item>(array: Item[], matches: (item: Item, index: number, array: Item[]) => boolean): number;
35
26
  /**
36
27
  * Get the number of items _(count)_ that match the given value
37
28
  */
@@ -39,7 +30,7 @@ export declare function count<Item, Key extends keyof Item>(array: Item[], key:
39
30
  /**
40
31
  * Get the number of items _(count)_ that match the given value
41
32
  */
42
- export declare function count<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key, value: ReturnType<Key>): number;
33
+ export declare function count<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key, value: ReturnType<Key>): number;
43
34
  /**
44
35
  * Does the value exist in array?
45
36
  */
@@ -47,7 +38,7 @@ export declare function exists<Item>(array: Item[], value: Item): boolean;
47
38
  /**
48
39
  * Does the value exist in array?
49
40
  */
50
- export declare function exists<Item>(array: Item[], matches: BooleanCallback<Item>): boolean;
41
+ export declare function exists<Item>(array: Item[], matches: (item: Item, index: number, array: Item[]) => boolean): boolean;
51
42
  /**
52
43
  * - Does the value exist in array?
53
44
  * - Use `key` to find a comparison value to match with `value`
@@ -57,7 +48,7 @@ export declare function exists<Item, Key extends keyof Item>(array: Item[], key:
57
48
  * - Does the value exist in array?
58
49
  * - Use `key` to find a comparison value to match with `value`
59
50
  */
60
- export declare function exists<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key, value: ReturnType<Key>): boolean;
51
+ export declare function exists<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key, value: ReturnType<Key>): boolean;
61
52
  /**
62
53
  * Get a filtered array of items matching `value`
63
54
  */
@@ -65,7 +56,7 @@ export declare function filter<Item>(array: Item[], value: Item): Item[];
65
56
  /**
66
57
  * Get a filtered array of items matching `value`
67
58
  */
68
- export declare function filter<Item>(array: Item[], matches: BooleanCallback<Item>): Item[];
59
+ export declare function filter<Item>(array: Item[], matches: (item: Item, index: number, array: Item[]) => boolean): Item[];
69
60
  /**
70
61
  * - Get a filtered array of items
71
62
  * - Use `key` to find a comparison value to match with `value`
@@ -75,7 +66,7 @@ export declare function filter<Item, Key extends keyof Item>(array: Item[], key:
75
66
  * - Get a filtered array of items
76
67
  * - Use `key` to find a comparison value to match with `value`
77
68
  */
78
- export declare function filter<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key, value: ReturnType<Key>): Item[];
69
+ export declare function filter<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key, value: ReturnType<Key>): Item[];
79
70
  /**
80
71
  * Get the first item matching `value` _(or `undefined` if no match is found)_
81
72
  */
@@ -83,7 +74,7 @@ export declare function find<Item>(array: Item[], value: Item): Item | undefined
83
74
  /**
84
75
  * Get the first item matching `value` _(or `undefined` if no match is found)_
85
76
  */
86
- export declare function find<Item>(array: Item[], matches: BooleanCallback<Item>): Item | undefined;
77
+ export declare function find<Item>(array: Item[], matches: (item: Item, index: number, array: Item[]) => boolean): Item | undefined;
87
78
  /**
88
79
  * - Get the first matching item _(or `undefined` if no match is found)_
89
80
  * - Use `key` to find a comparison value to match with `value`
@@ -93,7 +84,7 @@ export declare function find<Item, Key extends keyof Item>(array: Item[], key: K
93
84
  * - Get the first matching item _(or `undefined` if no match is found)_
94
85
  * - Use `key` to find a comparison value to match with `value`
95
86
  */
96
- export declare function find<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key, value: ReturnType<Key>): Item | undefined;
87
+ export declare function find<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key, value: ReturnType<Key>): Item | undefined;
97
88
  /**
98
89
  * Create a record from an array of items using a specific key
99
90
  */
@@ -105,11 +96,11 @@ export declare function groupBy<Item, Key extends keyof Item>(array: Item[], key
105
96
  /**
106
97
  * Create a record from an array of items using a specific key
107
98
  */
108
- export declare function groupBy<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key): Record<ReturnType<Key>, Item>;
99
+ export declare function groupBy<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key): Record<ReturnType<Key>, Item>;
109
100
  /**
110
101
  * Create a record from an array of items using a specific key, and grouping them into arrays
111
102
  */
112
- export declare function groupBy<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key, arrays: true): Record<ReturnType<Key>, Item[]>;
103
+ export declare function groupBy<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key, arrays: true): Record<ReturnType<Key>, Item[]>;
113
104
  /**
114
105
  * Create a record from an array of items using a specific key and value
115
106
  */
@@ -121,27 +112,27 @@ export declare function groupBy<Item, Key extends keyof Item, Value extends keyo
121
112
  /**
122
113
  * Create a record from an array of items using a specific key and value
123
114
  */
124
- export declare function groupBy<Item, Key extends keyof Item, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value): Record<KeyedValue<Item, Key>, ReturnType<Value>>;
115
+ export declare function groupBy<Item, Key extends keyof Item, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value): Record<KeyedValue<Item, Key>, ReturnType<Value>>;
125
116
  /**
126
117
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
127
118
  */
128
- export declare function groupBy<Item, Key extends keyof Item, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value, arrays: true): Record<KeyedValue<Item, Key>, Array<ReturnType<Value>>>;
119
+ export declare function groupBy<Item, Key extends keyof Item, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value, arrays: true): Record<KeyedValue<Item, Key>, Array<ReturnType<Value>>>;
129
120
  /**
130
121
  * Create a record from an array of items using a specific key and value
131
122
  */
132
- export declare function groupBy<Item, Key extends KeyCallback<Item>, Value extends keyof Item>(array: Item[], key: Key, value: Value): Record<ReturnType<Key>, KeyedValue<Item, Value>>;
123
+ export declare function groupBy<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends keyof Item>(array: Item[], key: Key, value: Value): Record<ReturnType<Key>, KeyedValue<Item, Value>>;
133
124
  /**
134
125
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
135
126
  */
136
- export declare function groupBy<Item, Key extends KeyCallback<Item>, Value extends keyof Item>(array: Item[], key: Key, value: Value, arrays: true): Record<ReturnType<Key>, Array<KeyedValue<Item, Value>>>;
127
+ export declare function groupBy<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends keyof Item>(array: Item[], key: Key, value: Value, arrays: true): Record<ReturnType<Key>, Array<KeyedValue<Item, Value>>>;
137
128
  /**
138
129
  * Create a record from an array of items using a specific key and value
139
130
  */
140
- export declare function groupBy<Item, Key extends KeyCallback<Item>, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value): Record<ReturnType<Key>, ReturnType<Value>>;
131
+ export declare function groupBy<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value): Record<ReturnType<Key>, ReturnType<Value>>;
141
132
  /**
142
133
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
143
134
  */
144
- export declare function groupBy<Item, Key extends KeyCallback<Item>, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value, arrays: true): Record<ReturnType<Key>, Array<ReturnType<Value>>>;
135
+ export declare function groupBy<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value, arrays: true): Record<ReturnType<Key>, Array<ReturnType<Value>>>;
145
136
  /**
146
137
  * Get the index for the first item matching `value` _(or `-1` if no match is found)_
147
138
  */
@@ -149,7 +140,7 @@ export declare function indexOf<Item>(array: Item[], value: Item): number;
149
140
  /**
150
141
  * Get the index for the first item matching `value` _(or `-1` if no match is found)_
151
142
  */
152
- export declare function indexOf<Item>(array: Item[], matches: BooleanCallback<Item>): number;
143
+ export declare function indexOf<Item>(array: Item[], matches: (item: Item, index: number, array: Item[]) => boolean): number;
153
144
  /**
154
145
  * - Get the index for the first matching item _(or `-1` if no match is found)_
155
146
  * - Use `key` to find a comparison value to match with `value`
@@ -159,7 +150,11 @@ export declare function indexOf<Item, Key extends keyof Item>(array: Item[], key
159
150
  * - Get the index for the first matching item _(or `-1` if no match is found)_
160
151
  * - Use `key` to find a comparison value to match with `value`
161
152
  */
162
- export declare function indexOf<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key, value: ReturnType<Key>): number;
153
+ export declare function indexOf<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key, value: ReturnType<Key>): number;
154
+ export type SortKey<Item> = {
155
+ direction: "asc" | "desc";
156
+ value: Key | ((item: Item) => Key);
157
+ };
163
158
  /**
164
159
  * - Insert values into an array _(at the end)_
165
160
  * - _(Uses chunking to avoid stack overflow_)
@@ -182,12 +177,12 @@ export declare function sort<Item>(array: Item[], descending?: boolean): Item[];
182
177
  * - Sort an array of items, using a `key` to sort by a specific value
183
178
  * - Defaults to ascending, but can be changed by setting `descending` to `true`, or using a `SortKey`
184
179
  */
185
- export declare function sort<Item>(array: Item[], key: Key | SortKey<Item> | SortKeyCallback<Item>, descending?: boolean): Item[];
180
+ export declare function sort<Item>(array: Item[], key: Key | SortKey<Item> | ((item: Item) => Key), descending?: boolean): Item[];
186
181
  /**
187
182
  * - Sort an array of items, using multiple `keys` to sort by specific values
188
183
  * - Defaults to ascending, but can be changed by setting `descending` to `true`, or using `SortKey`
189
184
  */
190
- export declare function sort<Item>(array: Item[], keys: Array<Key | SortKey<Item> | SortKeyCallback<Item>>, descending?: boolean): Item[];
185
+ export declare function sort<Item>(array: Item[], keys: Array<Key | SortKey<Item> | ((item: Item) => Key)>, descending?: boolean): Item[];
191
186
  /**
192
187
  * Removes and returns all items from an array starting from a specific index
193
188
  */
@@ -221,11 +216,11 @@ export declare function toMap<Item, Key extends keyof Item>(array: Item[], key:
221
216
  /**
222
217
  * Create a map from an array of items using a specific key
223
218
  */
224
- export declare function toMap<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key): Map<ReturnType<Key>, Item>;
219
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key): Map<ReturnType<Key>, Item>;
225
220
  /**
226
221
  * Create a map from an array of items using a specific key, and grouping them into arrays
227
222
  */
228
- export declare function toMap<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key, arrays: true): Map<ReturnType<Key>, Item[]>;
223
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key, arrays: true): Map<ReturnType<Key>, Item[]>;
229
224
  /**
230
225
  * Create a map from an array of items using a specific key and value
231
226
  */
@@ -237,27 +232,27 @@ export declare function toMap<Item, Key extends keyof Item, Value extends keyof
237
232
  /**
238
233
  * Create a map from an array of items using a specific key and value
239
234
  */
240
- export declare function toMap<Item, Key extends keyof Item, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value): Map<KeyedValue<Item, Key>, ReturnType<Value>>;
235
+ export declare function toMap<Item, Key extends keyof Item, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value): Map<KeyedValue<Item, Key>, ReturnType<Value>>;
241
236
  /**
242
237
  * Create a map from an array of items using a specific key and value, and grouping them into arrays
243
238
  */
244
- export declare function toMap<Item, Key extends keyof Item, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value, arrays: true): Map<KeyedValue<Item, Key>, Array<ReturnType<Value>>>;
239
+ export declare function toMap<Item, Key extends keyof Item, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value, arrays: true): Map<KeyedValue<Item, Key>, Array<ReturnType<Value>>>;
245
240
  /**
246
241
  * Create a map from an array of items using a specific key and value
247
242
  */
248
- export declare function toMap<Item, Key extends KeyCallback<Item>, Value extends keyof Item>(array: Item[], key: Key, value: Value): Map<ReturnType<Key>, KeyedValue<Item, Value>>;
243
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends keyof Item>(array: Item[], key: Key, value: Value): Map<ReturnType<Key>, KeyedValue<Item, Value>>;
249
244
  /**
250
245
  * Create a map from an array of items using a specific key and value, and grouping them into arrays
251
246
  */
252
- export declare function toMap<Item, Key extends KeyCallback<Item>, Value extends keyof Item>(array: Item[], key: Key, value: Value, arrays: true): Map<ReturnType<Key>, Array<KeyedValue<Item, Value>>>;
247
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends keyof Item>(array: Item[], key: Key, value: Value, arrays: true): Map<ReturnType<Key>, Array<KeyedValue<Item, Value>>>;
253
248
  /**
254
249
  * Create a map from an array of items using a specific key and value
255
250
  */
256
- export declare function toMap<Item, Key extends KeyCallback<Item>, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value): Map<ReturnType<Key>, ReturnType<Value>>;
251
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value): Map<ReturnType<Key>, ReturnType<Value>>;
257
252
  /**
258
253
  * Create a map from an array of items using a specific key and value, and grouping them into arrays
259
254
  */
260
- export declare function toMap<Item, Key extends KeyCallback<Item>, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value, arrays: true): Map<ReturnType<Key>, Array<ReturnType<Value>>>;
255
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value, arrays: true): Map<ReturnType<Key>, Array<ReturnType<Value>>>;
261
256
  /**
262
257
  * Create a record from an array of items _(using their indices as keys)_
263
258
  */
@@ -273,11 +268,11 @@ export declare function toRecord<Item, Key extends keyof Item>(array: Item[], ke
273
268
  /**
274
269
  * Create a record from an array of items using a specific key
275
270
  */
276
- export declare function toRecord<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key): Record<ReturnType<Key>, Item>;
271
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key): Record<ReturnType<Key>, Item>;
277
272
  /**
278
273
  * Create a record from an array of items using a specific key, and grouping them into arrays
279
274
  */
280
- export declare function toRecord<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key, arrays: true): Record<ReturnType<Key>, Item[]>;
275
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key, arrays: true): Record<ReturnType<Key>, Item[]>;
281
276
  /**
282
277
  * Create a record from an array of items using a specific key and value
283
278
  */
@@ -289,41 +284,41 @@ export declare function toRecord<Item, Key extends keyof Item, Value extends key
289
284
  /**
290
285
  * Create a record from an array of items using a specific key and value
291
286
  */
292
- export declare function toRecord<Item, Key extends keyof Item, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value): Record<KeyedValue<Item, Key>, ReturnType<Value>>;
287
+ export declare function toRecord<Item, Key extends keyof Item, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value): Record<KeyedValue<Item, Key>, ReturnType<Value>>;
293
288
  /**
294
289
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
295
290
  */
296
- export declare function toRecord<Item, Key extends keyof Item, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value, arrays: true): Record<KeyedValue<Item, Key>, Array<ReturnType<Value>>>;
291
+ export declare function toRecord<Item, Key extends keyof Item, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value, arrays: true): Record<KeyedValue<Item, Key>, Array<ReturnType<Value>>>;
297
292
  /**
298
293
  * Create a record from an array of items using a specific key and value
299
294
  */
300
- export declare function toRecord<Item, Key extends KeyCallback<Item>, Value extends keyof Item>(array: Item[], key: Key, value: Value): Record<ReturnType<Key>, KeyedValue<Item, Value>>;
295
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends keyof Item>(array: Item[], key: Key, value: Value): Record<ReturnType<Key>, KeyedValue<Item, Value>>;
301
296
  /**
302
297
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
303
298
  */
304
- export declare function toRecord<Item, Key extends KeyCallback<Item>, Value extends keyof Item>(array: Item[], key: Key, value: Value, arrays: true): Record<ReturnType<Key>, Array<KeyedValue<Item, Value>>>;
299
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends keyof Item>(array: Item[], key: Key, value: Value, arrays: true): Record<ReturnType<Key>, Array<KeyedValue<Item, Value>>>;
305
300
  /**
306
301
  * Create a record from an array of items using a specific key and value
307
302
  */
308
- export declare function toRecord<Item, Key extends KeyCallback<Item>, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value): Record<ReturnType<Key>, ReturnType<Value>>;
303
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value): Record<ReturnType<Key>, ReturnType<Value>>;
309
304
  /**
310
305
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
311
306
  */
312
- export declare function toRecord<Item, Key extends KeyCallback<Item>, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value, arrays: true): Record<ReturnType<Key>, Array<ReturnType<Value>>>;
307
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value, arrays: true): Record<ReturnType<Key>, Array<ReturnType<Value>>>;
313
308
  /**
314
309
  * Get an array of unique items
315
310
  */
316
311
  export declare function unique<Item>(array: Item[]): Item[];
317
312
  /**
318
313
  * - Get an array of unique items
319
- * - Use `key` to find a comparison value to match with `value`
314
+ * - Use `key` to find a comparison value for an item
320
315
  */
321
316
  export declare function unique<Item, Key extends keyof Item>(array: Item[], key: Key): Item[];
322
317
  /**
323
318
  * - Get an array of unique items
324
- * - Use `key` to find a comparison value to match with `value`
319
+ * - Use `key` to find a comparison value for an item
325
320
  */
326
- export declare function unique<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key): Item[];
321
+ export declare function unique<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key): Item[];
327
322
  /**
328
323
  * Flatten an array _(using native `flat` and maximum depth)_
329
324
  */
@@ -2,8 +2,6 @@
2
2
 
3
3
  export type GenericCallback = (...args: any[]) => any;
4
4
  export type Key = number | string;
5
- export type ArrayCallback<Item, Value> = (item: Item, index: number, array: Item[]) => Value;
6
- export type BooleanCallback<Item> = ArrayCallback<Item, boolean>;
7
5
  export type Callbacks = {
8
6
  bool?: GenericCallback;
9
7
  key?: GenericCallback;
@@ -11,16 +9,13 @@ export type Callbacks = {
11
9
  };
12
10
  export type FindType = "index" | "value";
13
11
  export type InsertType = "push" | "splice";
14
- export type KeyCallback<Item> = ArrayCallback<Item, Key>;
15
12
  export type SortKey<Item> = {
16
13
  direction: "asc" | "desc";
17
- value: Key | SortKeyCallback<Item>;
14
+ value: Key | ((item: Item) => Key);
18
15
  };
19
- export type SortKeyCallback<Item> = (item: Item) => unknown;
20
16
  export type SortKeyWithCallback<Item> = {
21
- callback: SortKeyCallback<Item>;
17
+ callback: (item: Item) => Key;
22
18
  direction: "asc" | "desc";
23
19
  };
24
- export type ValueCallback<Item> = ArrayCallback<Item, unknown>;
25
20
 
26
21
  export {};
@@ -1,6 +1,4 @@
1
1
  import type { GenericCallback, Key } from '~/models';
2
- export type ArrayCallback<Item, Value> = (item: Item, index: number, array: Item[]) => Value;
3
- export type BooleanCallback<Item> = ArrayCallback<Item, boolean>;
4
2
  export type Callbacks = {
5
3
  bool?: GenericCallback;
6
4
  key?: GenericCallback;
@@ -8,14 +6,11 @@ export type Callbacks = {
8
6
  };
9
7
  export type FindType = 'index' | 'value';
10
8
  export type InsertType = 'push' | 'splice';
11
- export type KeyCallback<Item> = ArrayCallback<Item, Key>;
12
9
  export type SortKey<Item> = {
13
10
  direction: 'asc' | 'desc';
14
- value: Key | SortKeyCallback<Item>;
11
+ value: Key | ((item: Item) => Key);
15
12
  };
16
- export type SortKeyCallback<Item> = (item: Item) => unknown;
17
13
  export type SortKeyWithCallback<Item> = {
18
- callback: SortKeyCallback<Item>;
14
+ callback: (item: Item) => Key;
19
15
  direction: 'asc' | 'desc';
20
16
  };
21
- export type ValueCallback<Item> = ArrayCallback<Item, unknown>;
@@ -3,9 +3,8 @@
3
3
  export type Key = number | string;
4
4
  export type SortKey<Item> = {
5
5
  direction: "asc" | "desc";
6
- value: Key | SortKeyCallback<Item>;
6
+ value: Key | ((item: Item) => Key);
7
7
  };
8
- export type SortKeyCallback<Item> = (item: Item) => unknown;
9
8
  /**
10
9
  * Sort an array of items _(defaults to ascending)_
11
10
  */
@@ -14,11 +13,11 @@ export declare function sort<Item>(array: Item[], descending?: boolean): Item[];
14
13
  * - Sort an array of items, using a `key` to sort by a specific value
15
14
  * - Defaults to ascending, but can be changed by setting `descending` to `true`, or using a `SortKey`
16
15
  */
17
- export declare function sort<Item>(array: Item[], key: Key | SortKey<Item> | SortKeyCallback<Item>, descending?: boolean): Item[];
16
+ export declare function sort<Item>(array: Item[], key: Key | SortKey<Item> | ((item: Item) => Key), descending?: boolean): Item[];
18
17
  /**
19
18
  * - Sort an array of items, using multiple `keys` to sort by specific values
20
19
  * - Defaults to ascending, but can be changed by setting `descending` to `true`, or using `SortKey`
21
20
  */
22
- export declare function sort<Item>(array: Item[], keys: Array<Key | SortKey<Item> | SortKeyCallback<Item>>, descending?: boolean): Item[];
21
+ export declare function sort<Item>(array: Item[], keys: Array<Key | SortKey<Item> | ((item: Item) => Key)>, descending?: boolean): Item[];
23
22
 
24
23
  export {};
@@ -1,4 +1,4 @@
1
- import type { SortKey, SortKeyCallback } from '~/array/models';
1
+ import type { SortKey } from '~/array/models';
2
2
  import type { Key } from '~/models';
3
3
  /**
4
4
  * Sort an array of items _(defaults to ascending)_
@@ -8,9 +8,9 @@ export declare function sort<Item>(array: Item[], descending?: boolean): Item[];
8
8
  * - Sort an array of items, using a `key` to sort by a specific value
9
9
  * - Defaults to ascending, but can be changed by setting `descending` to `true`, or using a `SortKey`
10
10
  */
11
- export declare function sort<Item>(array: Item[], key: Key | SortKey<Item> | SortKeyCallback<Item>, descending?: boolean): Item[];
11
+ export declare function sort<Item>(array: Item[], key: Key | SortKey<Item> | ((item: Item) => Key), descending?: boolean): Item[];
12
12
  /**
13
13
  * - Sort an array of items, using multiple `keys` to sort by specific values
14
14
  * - Defaults to ascending, but can be changed by setting `descending` to `true`, or using `SortKey`
15
15
  */
16
- export declare function sort<Item>(array: Item[], keys: Array<Key | SortKey<Item> | SortKeyCallback<Item>>, descending?: boolean): Item[];
16
+ export declare function sort<Item>(array: Item[], keys: Array<Key | SortKey<Item> | ((item: Item) => Key)>, descending?: boolean): Item[];
@@ -2,9 +2,6 @@
2
2
 
3
3
  export type KeyedValue<Item, Key extends keyof Item> = Item[Key] extends PropertyKey ? Item[Key] : never;
4
4
  export type Key = number | string;
5
- export type ArrayCallback<Item, Value> = (item: Item, index: number, array: Item[]) => Value;
6
- export type KeyCallback<Item> = ArrayCallback<Item, Key>;
7
- export type ValueCallback<Item> = ArrayCallback<Item, unknown>;
8
5
  /**
9
6
  * Create a map from an array of items _(using their indices as keys)_
10
7
  */
@@ -20,11 +17,11 @@ export declare function toMap<Item, Key extends keyof Item>(array: Item[], key:
20
17
  /**
21
18
  * Create a map from an array of items using a specific key
22
19
  */
23
- export declare function toMap<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key): Map<ReturnType<Key>, Item>;
20
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key): Map<ReturnType<Key>, Item>;
24
21
  /**
25
22
  * Create a map from an array of items using a specific key, and grouping them into arrays
26
23
  */
27
- export declare function toMap<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key, arrays: true): Map<ReturnType<Key>, Item[]>;
24
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key, arrays: true): Map<ReturnType<Key>, Item[]>;
28
25
  /**
29
26
  * Create a map from an array of items using a specific key and value
30
27
  */
@@ -36,26 +33,26 @@ export declare function toMap<Item, Key extends keyof Item, Value extends keyof
36
33
  /**
37
34
  * Create a map from an array of items using a specific key and value
38
35
  */
39
- export declare function toMap<Item, Key extends keyof Item, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value): Map<KeyedValue<Item, Key>, ReturnType<Value>>;
36
+ export declare function toMap<Item, Key extends keyof Item, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value): Map<KeyedValue<Item, Key>, ReturnType<Value>>;
40
37
  /**
41
38
  * Create a map from an array of items using a specific key and value, and grouping them into arrays
42
39
  */
43
- export declare function toMap<Item, Key extends keyof Item, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value, arrays: true): Map<KeyedValue<Item, Key>, Array<ReturnType<Value>>>;
40
+ export declare function toMap<Item, Key extends keyof Item, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value, arrays: true): Map<KeyedValue<Item, Key>, Array<ReturnType<Value>>>;
44
41
  /**
45
42
  * Create a map from an array of items using a specific key and value
46
43
  */
47
- export declare function toMap<Item, Key extends KeyCallback<Item>, Value extends keyof Item>(array: Item[], key: Key, value: Value): Map<ReturnType<Key>, KeyedValue<Item, Value>>;
44
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends keyof Item>(array: Item[], key: Key, value: Value): Map<ReturnType<Key>, KeyedValue<Item, Value>>;
48
45
  /**
49
46
  * Create a map from an array of items using a specific key and value, and grouping them into arrays
50
47
  */
51
- export declare function toMap<Item, Key extends KeyCallback<Item>, Value extends keyof Item>(array: Item[], key: Key, value: Value, arrays: true): Map<ReturnType<Key>, Array<KeyedValue<Item, Value>>>;
48
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends keyof Item>(array: Item[], key: Key, value: Value, arrays: true): Map<ReturnType<Key>, Array<KeyedValue<Item, Value>>>;
52
49
  /**
53
50
  * Create a map from an array of items using a specific key and value
54
51
  */
55
- export declare function toMap<Item, Key extends KeyCallback<Item>, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value): Map<ReturnType<Key>, ReturnType<Value>>;
52
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value): Map<ReturnType<Key>, ReturnType<Value>>;
56
53
  /**
57
54
  * Create a map from an array of items using a specific key and value, and grouping them into arrays
58
55
  */
59
- export declare function toMap<Item, Key extends KeyCallback<Item>, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value, arrays: true): Map<ReturnType<Key>, Array<ReturnType<Value>>>;
56
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value, arrays: true): Map<ReturnType<Key>, Array<ReturnType<Value>>>;
60
57
 
61
58
  export {};
@@ -1,5 +1,4 @@
1
- import type { KeyCallback, ValueCallback } from '~/array/models';
2
- import type { KeyedValue } from '~/models';
1
+ import type { KeyedValue, Key as SimpleKey } from '~/models';
3
2
  /**
4
3
  * Create a map from an array of items _(using their indices as keys)_
5
4
  */
@@ -15,11 +14,11 @@ export declare function toMap<Item, Key extends keyof Item>(array: Item[], key:
15
14
  /**
16
15
  * Create a map from an array of items using a specific key
17
16
  */
18
- export declare function toMap<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key): Map<ReturnType<Key>, Item>;
17
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => SimpleKey>(array: Item[], key: Key): Map<ReturnType<Key>, Item>;
19
18
  /**
20
19
  * Create a map from an array of items using a specific key, and grouping them into arrays
21
20
  */
22
- export declare function toMap<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key, arrays: true): Map<ReturnType<Key>, Item[]>;
21
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => SimpleKey>(array: Item[], key: Key, arrays: true): Map<ReturnType<Key>, Item[]>;
23
22
  /**
24
23
  * Create a map from an array of items using a specific key and value
25
24
  */
@@ -31,24 +30,24 @@ export declare function toMap<Item, Key extends keyof Item, Value extends keyof
31
30
  /**
32
31
  * Create a map from an array of items using a specific key and value
33
32
  */
34
- export declare function toMap<Item, Key extends keyof Item, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value): Map<KeyedValue<Item, Key>, ReturnType<Value>>;
33
+ export declare function toMap<Item, Key extends keyof Item, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value): Map<KeyedValue<Item, Key>, ReturnType<Value>>;
35
34
  /**
36
35
  * Create a map from an array of items using a specific key and value, and grouping them into arrays
37
36
  */
38
- export declare function toMap<Item, Key extends keyof Item, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value, arrays: true): Map<KeyedValue<Item, Key>, Array<ReturnType<Value>>>;
37
+ export declare function toMap<Item, Key extends keyof Item, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value, arrays: true): Map<KeyedValue<Item, Key>, Array<ReturnType<Value>>>;
39
38
  /**
40
39
  * Create a map from an array of items using a specific key and value
41
40
  */
42
- export declare function toMap<Item, Key extends KeyCallback<Item>, Value extends keyof Item>(array: Item[], key: Key, value: Value): Map<ReturnType<Key>, KeyedValue<Item, Value>>;
41
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => SimpleKey, Value extends keyof Item>(array: Item[], key: Key, value: Value): Map<ReturnType<Key>, KeyedValue<Item, Value>>;
43
42
  /**
44
43
  * Create a map from an array of items using a specific key and value, and grouping them into arrays
45
44
  */
46
- export declare function toMap<Item, Key extends KeyCallback<Item>, Value extends keyof Item>(array: Item[], key: Key, value: Value, arrays: true): Map<ReturnType<Key>, Array<KeyedValue<Item, Value>>>;
45
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => SimpleKey, Value extends keyof Item>(array: Item[], key: Key, value: Value, arrays: true): Map<ReturnType<Key>, Array<KeyedValue<Item, Value>>>;
47
46
  /**
48
47
  * Create a map from an array of items using a specific key and value
49
48
  */
50
- export declare function toMap<Item, Key extends KeyCallback<Item>, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value): Map<ReturnType<Key>, ReturnType<Value>>;
49
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => SimpleKey, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value): Map<ReturnType<Key>, ReturnType<Value>>;
51
50
  /**
52
51
  * Create a map from an array of items using a specific key and value, and grouping them into arrays
53
52
  */
54
- export declare function toMap<Item, Key extends KeyCallback<Item>, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value, arrays: true): Map<ReturnType<Key>, Array<ReturnType<Value>>>;
53
+ export declare function toMap<Item, Key extends (item: Item, index: number, array: Item[]) => SimpleKey, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value, arrays: true): Map<ReturnType<Key>, Array<ReturnType<Value>>>;
@@ -2,9 +2,6 @@
2
2
 
3
3
  export type KeyedValue<Item, Key extends keyof Item> = Item[Key] extends PropertyKey ? Item[Key] : never;
4
4
  export type Key = number | string;
5
- export type ArrayCallback<Item, Value> = (item: Item, index: number, array: Item[]) => Value;
6
- export type KeyCallback<Item> = ArrayCallback<Item, Key>;
7
- export type ValueCallback<Item> = ArrayCallback<Item, unknown>;
8
5
  /**
9
6
  * Create a record from an array of items _(using their indices as keys)_
10
7
  */
@@ -20,11 +17,11 @@ export declare function toRecord<Item, Key extends keyof Item>(array: Item[], ke
20
17
  /**
21
18
  * Create a record from an array of items using a specific key
22
19
  */
23
- export declare function toRecord<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key): Record<ReturnType<Key>, Item>;
20
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key): Record<ReturnType<Key>, Item>;
24
21
  /**
25
22
  * Create a record from an array of items using a specific key, and grouping them into arrays
26
23
  */
27
- export declare function toRecord<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key, arrays: true): Record<ReturnType<Key>, Item[]>;
24
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key, arrays: true): Record<ReturnType<Key>, Item[]>;
28
25
  /**
29
26
  * Create a record from an array of items using a specific key and value
30
27
  */
@@ -36,26 +33,26 @@ export declare function toRecord<Item, Key extends keyof Item, Value extends key
36
33
  /**
37
34
  * Create a record from an array of items using a specific key and value
38
35
  */
39
- export declare function toRecord<Item, Key extends keyof Item, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value): Record<KeyedValue<Item, Key>, ReturnType<Value>>;
36
+ export declare function toRecord<Item, Key extends keyof Item, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value): Record<KeyedValue<Item, Key>, ReturnType<Value>>;
40
37
  /**
41
38
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
42
39
  */
43
- export declare function toRecord<Item, Key extends keyof Item, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value, arrays: true): Record<KeyedValue<Item, Key>, Array<ReturnType<Value>>>;
40
+ export declare function toRecord<Item, Key extends keyof Item, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value, arrays: true): Record<KeyedValue<Item, Key>, Array<ReturnType<Value>>>;
44
41
  /**
45
42
  * Create a record from an array of items using a specific key and value
46
43
  */
47
- export declare function toRecord<Item, Key extends KeyCallback<Item>, Value extends keyof Item>(array: Item[], key: Key, value: Value): Record<ReturnType<Key>, KeyedValue<Item, Value>>;
44
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends keyof Item>(array: Item[], key: Key, value: Value): Record<ReturnType<Key>, KeyedValue<Item, Value>>;
48
45
  /**
49
46
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
50
47
  */
51
- export declare function toRecord<Item, Key extends KeyCallback<Item>, Value extends keyof Item>(array: Item[], key: Key, value: Value, arrays: true): Record<ReturnType<Key>, Array<KeyedValue<Item, Value>>>;
48
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends keyof Item>(array: Item[], key: Key, value: Value, arrays: true): Record<ReturnType<Key>, Array<KeyedValue<Item, Value>>>;
52
49
  /**
53
50
  * Create a record from an array of items using a specific key and value
54
51
  */
55
- export declare function toRecord<Item, Key extends KeyCallback<Item>, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value): Record<ReturnType<Key>, ReturnType<Value>>;
52
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value): Record<ReturnType<Key>, ReturnType<Value>>;
56
53
  /**
57
54
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
58
55
  */
59
- export declare function toRecord<Item, Key extends KeyCallback<Item>, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value, arrays: true): Record<ReturnType<Key>, Array<ReturnType<Value>>>;
56
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => Key, Value extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: Key, value: Value, arrays: true): Record<ReturnType<Key>, Array<ReturnType<Value>>>;
60
57
 
61
58
  export {};