@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,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 record from an array of items _(using their indices as keys)_
5
4
  */
@@ -15,11 +14,11 @@ export declare function toRecord<Item, Key extends keyof Item>(array: Item[], ke
15
14
  /**
16
15
  * Create a record from an array of items using a specific key
17
16
  */
18
- export declare function toRecord<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key): Record<ReturnType<Key>, Item>;
17
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => SimpleKey>(array: Item[], key: Key): Record<ReturnType<Key>, Item>;
19
18
  /**
20
19
  * Create a record from an array of items using a specific key, and grouping them into arrays
21
20
  */
22
- export declare function toRecord<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key, arrays: true): Record<ReturnType<Key>, Item[]>;
21
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => SimpleKey>(array: Item[], key: Key, arrays: true): Record<ReturnType<Key>, Item[]>;
23
22
  /**
24
23
  * Create a record from an array of items using a specific key and value
25
24
  */
@@ -31,24 +30,24 @@ export declare function toRecord<Item, Key extends keyof Item, Value extends key
31
30
  /**
32
31
  * Create a record from an array of items using a specific key and value
33
32
  */
34
- 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>>;
33
+ 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>>;
35
34
  /**
36
35
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
37
36
  */
38
- 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>>>;
37
+ 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>>>;
39
38
  /**
40
39
  * Create a record from an array of items using a specific key and value
41
40
  */
42
- 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>>;
41
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => SimpleKey, Value extends keyof Item>(array: Item[], key: Key, value: Value): Record<ReturnType<Key>, KeyedValue<Item, Value>>;
43
42
  /**
44
43
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
45
44
  */
46
- 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>>>;
45
+ export declare function toRecord<Item, Key extends (item: Item, index: number, array: Item[]) => SimpleKey, Value extends keyof Item>(array: Item[], key: Key, value: Value, arrays: true): Record<ReturnType<Key>, Array<KeyedValue<Item, Value>>>;
47
46
  /**
48
47
  * Create a record from an array of items using a specific key and value
49
48
  */
50
- export declare function toRecord<Item, Key extends KeyCallback<Item>, Value extends ValueCallback<Item>>(array: Item[], key: Key, value: Value): Record<ReturnType<Key>, ReturnType<Value>>;
49
+ export declare function toRecord<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): Record<ReturnType<Key>, ReturnType<Value>>;
51
50
  /**
52
51
  * Create a record from an array of items using a specific key and value, and grouping them into arrays
53
52
  */
54
- 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>>>;
53
+ export declare function toRecord<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): Record<ReturnType<Key>, Array<ReturnType<Value>>>;
@@ -1,21 +1,19 @@
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 KeyCallback<Item> = ArrayCallback<Item, Key>;
6
4
  /**
7
5
  * Get an array of unique items
8
6
  */
9
7
  export declare function unique<Item>(array: Item[]): Item[];
10
8
  /**
11
9
  * - Get an array of unique items
12
- * - Use `key` to find a comparison value to match with `value`
10
+ * - Use `key` to find a comparison value for an item
13
11
  */
14
12
  export declare function unique<Item, Key extends keyof Item>(array: Item[], key: Key): Item[];
15
13
  /**
16
14
  * - Get an array of unique items
17
- * - Use `key` to find a comparison value to match with `value`
15
+ * - Use `key` to find a comparison value for an item
18
16
  */
19
- export declare function unique<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key): Item[];
17
+ export declare function unique<Item, Key extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], key: Key): Item[];
20
18
 
21
19
  export {};
@@ -1,15 +1,15 @@
1
- import type { KeyCallback } from '~/array/models';
1
+ import type { Key as SimpleKey } from '~/models';
2
2
  /**
3
3
  * Get an array of unique items
4
4
  */
5
5
  export declare function unique<Item>(array: Item[]): Item[];
6
6
  /**
7
7
  * - Get an array of unique items
8
- * - Use `key` to find a comparison value to match with `value`
8
+ * - Use `key` to find a comparison value for an item
9
9
  */
10
10
  export declare function unique<Item, Key extends keyof Item>(array: Item[], key: Key): Item[];
11
11
  /**
12
12
  * - Get an array of unique items
13
- * - Use `key` to find a comparison value to match with `value`
13
+ * - Use `key` to find a comparison value for an item
14
14
  */
15
- export declare function unique<Item, Key extends KeyCallback<Item>>(array: Item[], key: Key): Item[];
15
+ export declare function unique<Item, Key extends (item: Item, index: number, array: Item[]) => SimpleKey>(array: Item[], key: Key): Item[];