@oscarpalmer/atoms 0.166.2 → 0.166.3

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 (54) 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 +72 -72
  17. package/dist/internal/array/index-of.d.mts +1 -1
  18. package/dist/internal/math/aggregate.d.mts +1 -1
  19. package/dist/internal/value/partial.d.mts +2 -2
  20. package/dist/math.d.mts +1 -1
  21. package/dist/models.d.mts +7 -7
  22. package/dist/promise/models.d.mts +4 -4
  23. package/dist/sized/map.d.mts +11 -11
  24. package/dist/value/omit.d.mts +1 -1
  25. package/dist/value/pick.d.mts +1 -1
  26. package/dist/value/smush.d.mts +1 -1
  27. package/dist/value/unsmush.d.mts +1 -1
  28. package/package.json +1 -1
  29. package/src/array/difference.ts +2 -2
  30. package/src/array/exists.ts +3 -3
  31. package/src/array/filter.ts +6 -6
  32. package/src/array/find.ts +3 -3
  33. package/src/array/intersection.ts +2 -2
  34. package/src/array/move.ts +4 -4
  35. package/src/array/partition.ts +3 -3
  36. package/src/array/select.ts +3 -3
  37. package/src/array/slice.ts +6 -6
  38. package/src/array/sort.ts +4 -4
  39. package/src/array/swap.ts +4 -4
  40. package/src/array/to-set.ts +3 -3
  41. package/src/array/toggle.ts +2 -2
  42. package/src/array/union.ts +2 -2
  43. package/src/array/update.ts +2 -2
  44. package/src/internal/array/index-of.ts +3 -3
  45. package/src/internal/math/aggregate.ts +2 -2
  46. package/src/internal/value/partial.ts +9 -9
  47. package/src/math.ts +3 -3
  48. package/src/models.ts +30 -20
  49. package/src/promise/models.ts +13 -11
  50. package/src/sized/map.ts +14 -14
  51. package/src/value/omit.ts +3 -3
  52. package/src/value/pick.ts +3 -3
  53. package/src/value/smush.ts +1 -1
  54. package/src/value/unsmush.ts +1 -1
@@ -16,7 +16,7 @@ declare function difference<First, Second>(first: First[], second: Second[], cal
16
16
  * @param key Key to get an item's value for comparison
17
17
  * @returns Unique values from the first array
18
18
  */
19
- declare function difference<First extends PlainObject, Second extends PlainObject, Key extends keyof First & keyof Second>(first: First[], second: Second[], key: Key): First[];
19
+ declare function difference<First extends PlainObject, Second extends PlainObject, SharedKey extends keyof First & keyof Second>(first: First[], second: Second[], key: SharedKey): First[];
20
20
  /**
21
21
  * Get the items from the first array that are not in the second array
22
22
  * @param first First array
@@ -16,7 +16,7 @@ declare function exists<Item, Callback extends (item: Item, index: number, array
16
16
  * @param value Value to match against
17
17
  * @returns `true` if the item exists in the array, otherwise `false`
18
18
  */
19
- declare function exists<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): boolean;
19
+ declare function exists<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): boolean;
20
20
  /**
21
21
  * Does an item in the array match the filter?
22
22
  * @param array Array to search in
@@ -16,7 +16,7 @@ declare function filter<Item, Callback extends (item: Item, index: number, array
16
16
  * @param value Value to match against
17
17
  * @returns Filtered array of items
18
18
  */
19
- declare function filter<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): Item[];
19
+ declare function filter<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item[];
20
20
  /**
21
21
  * Get a filtered array of items matching the filter
22
22
  * @param array Array to search in
@@ -35,7 +35,7 @@ declare namespace filter {
35
35
  var remove: typeof removeFiltered;
36
36
  }
37
37
  declare function removeFiltered<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback, value: ReturnType<Callback>): unknown[];
38
- declare function removeFiltered<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): unknown[];
38
+ declare function removeFiltered<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): unknown[];
39
39
  declare function removeFiltered<Item>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean): unknown[];
40
40
  declare function removeFiltered<Item>(array: Item[], item: Item): unknown[];
41
41
  //#endregion
@@ -16,7 +16,7 @@ declare function find<Item, Callback extends (item: Item, index: number, array:
16
16
  * @param value Value to match against
17
17
  * @returns First item that matches the value, or `undefined` if no match is found
18
18
  */
19
- declare function find<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): Item | undefined;
19
+ declare function find<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item | undefined;
20
20
  /**
21
21
  * Get the first item matching the filter
22
22
  * @param array Array to search in
@@ -14,7 +14,7 @@ declare function intersection<First, Second>(first: First[], second: Second[], c
14
14
  * @param key Key to get an item's value for comparison
15
15
  * @returns Common values from both arrays
16
16
  */
17
- 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[];
17
+ 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[];
18
18
  /**
19
19
  * Get the common values between two arrays
20
20
  * @param first First array
@@ -13,7 +13,7 @@ import { PlainObject } from "../models.mjs";
13
13
  * @param key Key to get an item's value for matching
14
14
  * @returns Original array with items moved _(or unchanged if unable to move)_
15
15
  */
16
- declare function move<Item extends PlainObject, Key extends keyof Item>(array: Item[], from: Item | Item[], to: Item | Item[], key: Key): Item[];
16
+ declare function move<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], from: Item | Item[], to: Item | Item[], key: ItemKey): Item[];
17
17
  /**
18
18
  * Move an item _(or array of items)_ to the position of another item _(or array of items)_ within an array
19
19
  *
@@ -63,7 +63,7 @@ declare function moveIndices<Item>(array: Item[], from: number, to: number): Ite
63
63
  * @param key Key to get an item's value for matching
64
64
  * @returns Original array with items moved _(or unchanged if unable to move)_
65
65
  */
66
- declare function moveToIndex<Item extends PlainObject, Key extends keyof Item>(array: Item[], value: Item | Item[], index: number, key: Key): Item[];
66
+ declare function moveToIndex<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], value: Item | Item[], index: number, key: ItemKey): Item[];
67
67
  /**
68
68
  * Move an item _(or array of items)_ to an index within an array
69
69
  *
@@ -16,7 +16,7 @@ declare function partition<Item, Callback extends (item: Item, index: number, ar
16
16
  * @param value Value to match against
17
17
  * @returns Partitioned array of items
18
18
  */
19
- declare function partition<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): Item[][];
19
+ declare function partition<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item[][];
20
20
  /**
21
21
  * Get a partitioned array of items
22
22
  * @param array Array to search in
@@ -18,7 +18,7 @@ declare function select<Item, FilterCallback extends (item: Item, index: number,
18
18
  * @param mapCallback Callback to map the matched items
19
19
  * @returns Filtered and mapped array of items
20
20
  */
21
- 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>>;
21
+ 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>>;
22
22
  /**
23
23
  * Get a filtered and mapped array of items
24
24
  * @param array Array to search in
@@ -8,7 +8,7 @@ import { PlainObject } from "../models.mjs";
8
8
  * @param value Value to match against
9
9
  * @returns New array with items dropped
10
10
  */
11
- declare function drop<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): Item[];
11
+ declare function drop<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item[];
12
12
  /**
13
13
  * Drop items from the start of an array until they match a value
14
14
  * @param array Original array
@@ -59,7 +59,7 @@ declare function slice<Item>(array: Item[]): Item[];
59
59
  * @param value Value to match against
60
60
  * @returns New array with taken items
61
61
  */
62
- declare function take<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key, value: Item[Key]): Item[];
62
+ declare function take<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey, value: Item[ItemKey]): Item[];
63
63
  /**
64
64
  * Take items from the start of an array until they match a value
65
65
  * @param array Original array
@@ -17,11 +17,11 @@ type ArrayComparisonSorter<Item> = {
17
17
  /**
18
18
  * Sorting information for arrays _(using a key)_
19
19
  */
20
- type ArrayKeySorter<Item extends PlainObject, Key extends keyof Item> = {
20
+ type ArrayKeySorter<Item extends PlainObject, ItemKey extends keyof Item> = {
21
21
  /**
22
22
  * Comparator to use when comparing items and values
23
23
  */
24
- compare?: CompareCallback<Item, Item[Key]>;
24
+ compare?: CompareCallback<Item, Item[ItemKey]>;
25
25
  /**
26
26
  * Direction to sort by
27
27
  */
@@ -29,12 +29,12 @@ type ArrayKeySorter<Item extends PlainObject, Key extends keyof Item> = {
29
29
  /**
30
30
  * Key to sort by
31
31
  */
32
- key: Key;
32
+ key: ItemKey;
33
33
  };
34
34
  /**
35
35
  * Sorters based on keys in an object
36
36
  */
37
- type ArrayKeySorters<Item extends PlainObject> = { [Key in keyof Item]: ArrayKeySorter<Item, Key> }[keyof Item];
37
+ type ArrayKeySorters<Item extends PlainObject> = { [ItemKey in keyof Item]: ArrayKeySorter<Item, ItemKey> }[keyof Item];
38
38
  /**
39
39
  * Sorting information for arrays _(using a value callback and built-in comparison)_
40
40
  */
@@ -11,7 +11,7 @@ import { PlainObject } from "../models.mjs";
11
11
  * @param key Key to get an item's value for matching
12
12
  * @returns Original array with items swapped _(or unchanged if unable to swap)_
13
13
  */
14
- declare function swap<Item extends PlainObject, Key extends keyof Item>(array: Item[], first: Item[], second: Item[], key: Key): Item[];
14
+ declare function swap<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], first: Item[], second: Item[], key: ItemKey): Item[];
15
15
  /**
16
16
  * Swap two smaller arrays within a larger array
17
17
  *
@@ -43,7 +43,7 @@ declare function swap<Item>(array: Item[], first: Item[], second: Item[]): Item[
43
43
  * @param key Key to get an item's value for matching
44
44
  * @returns Original array with items swapped _(or unchanged if unable to swap)_
45
45
  */
46
- declare function swap<Item extends PlainObject, Key extends keyof Item>(array: Item[], first: Item, second: Item, key: Key): Item[];
46
+ declare function swap<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], first: Item, second: Item, key: ItemKey): Item[];
47
47
  /**
48
48
  * Swap two indiced items in an array
49
49
  *
@@ -14,7 +14,7 @@ declare function toSet<Item, Callback extends (item: Item, index: number, array:
14
14
  * @param key Key to use for value
15
15
  * @returns Set of values
16
16
  */
17
- declare function toSet<Item extends PlainObject, Key extends keyof Item>(array: Item[], key: Key): Set<Item[Key]>;
17
+ declare function toSet<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey): Set<Item[ItemKey]>;
18
18
  /**
19
19
  * Create a Set from an array of items
20
20
  * @param array Array to convert
@@ -16,7 +16,7 @@ declare function toggle<Item>(destination: Item[], toggled: Item[], callback: (i
16
16
  * @param key Key to find existing item
17
17
  * @returns Original array
18
18
  */
19
- declare function toggle<Item extends PlainObject, Key extends keyof Item>(destination: Item[], toggled: Item[], key: Key): Item[];
19
+ declare function toggle<Item extends PlainObject, ItemKey extends keyof Item>(destination: Item[], toggled: Item[], key: ItemKey): Item[];
20
20
  /**
21
21
  * Toggle an item in an array: if the item exists, it will be removed; if it doesn't, it will be added
22
22
  * @param destination Array to toggle within
@@ -14,7 +14,7 @@ declare function union<First, Second>(first: First[], second: Second[], callback
14
14
  * @param key Key to get an item's value for comparison
15
15
  * @returns Combined, unique values from both arrays
16
16
  */
17
- 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)[];
17
+ 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)[];
18
18
  /**
19
19
  * Get the combined, unique values from two arrays
20
20
  * @param first First array
@@ -16,7 +16,7 @@ declare function update<Item>(destination: Item[], updated: Item[], callback: (i
16
16
  * @param key Key to find existing item
17
17
  * @returns Original array
18
18
  */
19
- declare function update<Item extends PlainObject, Key extends keyof Item>(destination: Item[], updated: Item[], key: Key): Item[];
19
+ declare function update<Item extends PlainObject, ItemKey extends keyof Item>(destination: Item[], updated: Item[], key: ItemKey): Item[];
20
20
  /**
21
21
  * Update an item in an array: if the item exists, it will be updated; if it doesn't, it will be added
22
22
  * @param destination Array to update within