@oscarpalmer/atoms 0.193.0 → 0.193.1

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 (126) hide show
  1. package/package.json +3 -4
  2. package/src/array/difference.ts +0 -73
  3. package/src/array/exists.ts +0 -93
  4. package/src/array/filter.ts +0 -182
  5. package/src/array/find.ts +0 -183
  6. package/src/array/first.ts +0 -196
  7. package/src/array/flatten.ts +0 -20
  8. package/src/array/from.ts +0 -129
  9. package/src/array/get.ts +0 -131
  10. package/src/array/group-by.ts +0 -369
  11. package/src/array/index.ts +0 -26
  12. package/src/array/insert.ts +0 -52
  13. package/src/array/intersection.ts +0 -72
  14. package/src/array/last.ts +0 -194
  15. package/src/array/match.ts +0 -436
  16. package/src/array/move.ts +0 -315
  17. package/src/array/partition.ts +0 -91
  18. package/src/array/push.ts +0 -23
  19. package/src/array/reverse.ts +0 -33
  20. package/src/array/select.ts +0 -260
  21. package/src/array/single.ts +0 -93
  22. package/src/array/slice.ts +0 -335
  23. package/src/array/sort.ts +0 -607
  24. package/src/array/splice.ts +0 -106
  25. package/src/array/swap.ts +0 -322
  26. package/src/array/to-map.ts +0 -371
  27. package/src/array/to-record.ts +0 -351
  28. package/src/array/to-set.ts +0 -80
  29. package/src/array/toggle.ts +0 -79
  30. package/src/array/union.ts +0 -72
  31. package/src/array/unique.ts +0 -67
  32. package/src/array/update.ts +0 -75
  33. package/src/beacon.ts +0 -378
  34. package/src/color/constants.ts +0 -137
  35. package/src/color/index.ts +0 -83
  36. package/src/color/instance.ts +0 -162
  37. package/src/color/misc/alpha.ts +0 -56
  38. package/src/color/misc/format.ts +0 -29
  39. package/src/color/misc/get.ts +0 -210
  40. package/src/color/misc/is.ts +0 -221
  41. package/src/color/misc/state.ts +0 -243
  42. package/src/color/models.ts +0 -389
  43. package/src/color/space/hex.ts +0 -184
  44. package/src/color/space/hsl.ts +0 -174
  45. package/src/color/space/hwb.ts +0 -153
  46. package/src/color/space/rgb.ts +0 -240
  47. package/src/function/assert.ts +0 -174
  48. package/src/function/index.ts +0 -2
  49. package/src/function/limit.ts +0 -83
  50. package/src/function/memoize.ts +0 -202
  51. package/src/function/once.ts +0 -200
  52. package/src/function/retry.ts +0 -175
  53. package/src/function/work.ts +0 -1007
  54. package/src/herald.ts +0 -216
  55. package/src/index.ts +0 -68
  56. package/src/internal/array/callbacks.ts +0 -46
  57. package/src/internal/array/chunk.ts +0 -51
  58. package/src/internal/array/compact.ts +0 -56
  59. package/src/internal/array/find.ts +0 -200
  60. package/src/internal/array/group.ts +0 -42
  61. package/src/internal/array/index-of.ts +0 -182
  62. package/src/internal/array/insert.ts +0 -80
  63. package/src/internal/array/overlap.ts +0 -35
  64. package/src/internal/array/sets.ts +0 -74
  65. package/src/internal/array/shuffle.ts +0 -33
  66. package/src/internal/array/update.ts +0 -52
  67. package/src/internal/function/misc.ts +0 -8
  68. package/src/internal/function/timer.ts +0 -168
  69. package/src/internal/is.ts +0 -244
  70. package/src/internal/math/aggregate.ts +0 -164
  71. package/src/internal/math/misc.ts +0 -28
  72. package/src/internal/number.ts +0 -129
  73. package/src/internal/random.ts +0 -49
  74. package/src/internal/result.ts +0 -92
  75. package/src/internal/sized.ts +0 -25
  76. package/src/internal/string.ts +0 -128
  77. package/src/internal/subscription.ts +0 -264
  78. package/src/internal/value/compare.ts +0 -170
  79. package/src/internal/value/equal.ts +0 -465
  80. package/src/internal/value/get.ts +0 -57
  81. package/src/internal/value/handlers.ts +0 -95
  82. package/src/internal/value/has.ts +0 -118
  83. package/src/internal/value/misc.ts +0 -125
  84. package/src/internal/value/partial.ts +0 -46
  85. package/src/internal/value/set.ts +0 -132
  86. package/src/is.ts +0 -182
  87. package/src/logger.ts +0 -230
  88. package/src/math.ts +0 -281
  89. package/src/models.ts +0 -286
  90. package/src/number.ts +0 -1
  91. package/src/promise/delay.ts +0 -62
  92. package/src/promise/helpers.ts +0 -96
  93. package/src/promise/index.ts +0 -300
  94. package/src/promise/misc.ts +0 -96
  95. package/src/promise/models.ts +0 -195
  96. package/src/promise/timed.ts +0 -91
  97. package/src/query.ts +0 -147
  98. package/src/queue.ts +0 -814
  99. package/src/random.ts +0 -125
  100. package/src/result/index.ts +0 -105
  101. package/src/result/match.ts +0 -124
  102. package/src/result/misc.ts +0 -129
  103. package/src/result/models.ts +0 -83
  104. package/src/result/work/flow.ts +0 -488
  105. package/src/result/work/pipe.ts +0 -496
  106. package/src/sized/map.ts +0 -110
  107. package/src/sized/set.ts +0 -107
  108. package/src/string/case.ts +0 -236
  109. package/src/string/fuzzy.ts +0 -444
  110. package/src/string/index.ts +0 -199
  111. package/src/string/match.ts +0 -80
  112. package/src/string/normalize.ts +0 -205
  113. package/src/string/template.ts +0 -161
  114. package/src/value/clone.ts +0 -319
  115. package/src/value/collection.ts +0 -63
  116. package/src/value/diff.ts +0 -232
  117. package/src/value/freeze.ts +0 -322
  118. package/src/value/handle.ts +0 -3
  119. package/src/value/index.ts +0 -5
  120. package/src/value/merge.ts +0 -278
  121. package/src/value/omit.ts +0 -20
  122. package/src/value/pick.ts +0 -20
  123. package/src/value/shake.ts +0 -45
  124. package/src/value/smush.ts +0 -89
  125. package/src/value/transform.ts +0 -153
  126. package/src/value/unsmush.ts +0 -84
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oscarpalmer/atoms",
3
- "version": "0.193.0",
3
+ "version": "0.193.1",
4
4
  "description": "Atomic utilities for making your JavaScript better.",
5
5
  "keywords": [
6
6
  "helper",
@@ -17,8 +17,7 @@
17
17
  },
18
18
  "files": [
19
19
  "dist",
20
- "plugin",
21
- "src"
20
+ "plugin"
22
21
  ],
23
22
  "type": "module",
24
23
  "module": "./dist/index.mjs",
@@ -269,4 +268,4 @@
269
268
  "vitest": "npm:@voidzero-dev/vite-plus-test@latest"
270
269
  },
271
270
  "packageManager": "npm@11.11.1"
272
- }
271
+ }
@@ -1,73 +0,0 @@
1
- import {COMPARE_SETS_DIFFERENCE, compareSets} from '../internal/array/sets';
2
- import type {PlainObject} from '../models';
3
-
4
- // #region Functions
5
-
6
- /**
7
- * Get the items from the first array that are not in the second array
8
- *
9
- * @param first First array
10
- * @param second Second array
11
- * @param callback Callback to get an item's value for comparison
12
- * @returns Unique values from the first array
13
- *
14
- * @example
15
- * ```typescript
16
- * difference(
17
- * [{id: 1}, {id: 2}, {id: 3}],
18
- * [{id: 2}, {id: 4}],
19
- * item => item.id,
20
- * ); // => [{id: 1}, {id: 3}]
21
- * ```
22
- */
23
- export function difference<First, Second>(
24
- first: First[],
25
- second: Second[],
26
- callback: (item: First | Second) => unknown,
27
- ): First[];
28
-
29
- /**
30
- * Get the items from the first array that are not in the second array
31
- *
32
- * @param first First array
33
- * @param second Second array
34
- * @param key Key to get an item's value for comparison
35
- * @returns Unique values from the first array
36
- *
37
- * @example
38
- * ```typescript
39
- * difference(
40
- * [{id: 1}, {id: 2}, {id: 3}],
41
- * [{id: 2}, {id: 4}],
42
- * 'id',
43
- * ); // => [{id: 1}, {id: 3}]
44
- * ```
45
- */
46
- export function difference<
47
- First extends PlainObject,
48
- Second extends PlainObject,
49
- SharedKey extends keyof First & keyof Second,
50
- >(first: First[], second: Second[], key: SharedKey): First[];
51
-
52
- /**
53
- * Get the items from the first array that are not in the second array
54
- *
55
- * @param first First array
56
- * @param second Second array
57
- * @returns Unique values from the first array
58
- *
59
- * @example
60
- * ```typescript
61
- * difference(
62
- * [1, 2, 3],
63
- * [2, 4],
64
- * ); // => [1, 3]
65
- * ```
66
- */
67
- export function difference<First, Second>(first: First[], second: Second[]): First[];
68
-
69
- export function difference(first: unknown[], second: unknown[], key?: unknown): unknown[] {
70
- return compareSets(COMPARE_SETS_DIFFERENCE, first, second, key);
71
- }
72
-
73
- // #endregion
@@ -1,93 +0,0 @@
1
- import {FIND_VALUE_INDEX, findValue} from '../internal/array/find';
2
- import type {PlainObject} from '../models';
3
-
4
- // #region Functions
5
-
6
- /**
7
- * Does an item with a specific value exist in the array?
8
- *
9
- * @param array Array to search in
10
- * @param callback Callback to get an item's value for matching
11
- * @param value Value to match against
12
- * @returns `true` if the item exists in the array, otherwise `false`
13
- *
14
- * @example
15
- * ```typescript
16
- * exists(
17
- * [{id: 1}, {id: 2}, {id: 3}],
18
- * item => item.id,
19
- * 2,
20
- * ); // => true
21
- * ```
22
- */
23
- export function exists<
24
- Item,
25
- Callback extends (item: Item, index: number, array: Item[]) => unknown,
26
- >(array: Item[], callback: Callback, value: ReturnType<Callback>): boolean;
27
-
28
- /**
29
- * Does an item with a specific value exist in the array?
30
- *
31
- * @param array Array to search in
32
- * @param key Key to get an item's value for matching
33
- * @param value Value to match against
34
- * @returns `true` if the item exists in the array, otherwise `false`
35
- *
36
- * @example
37
- * ```typescript
38
- * exists(
39
- * [{id: 1}, {id: 2}, {id: 3}],
40
- * 'id',
41
- * 2,
42
- * ); // => true
43
- * ```
44
- */
45
- export function exists<Item extends PlainObject, ItemKey extends keyof Item>(
46
- array: Item[],
47
- key: ItemKey,
48
- value: Item[ItemKey],
49
- ): boolean;
50
-
51
- /**
52
- * Does an item in the array match the filter?
53
- *
54
- * @param array Array to search in
55
- * @param filter Filter callback to match items
56
- * @returns `true` if a matching item exists, otherwise `false`
57
- *
58
- * @example
59
- * ```typescript
60
- * exists(
61
- * [{id: 1}, {id: 2}, {id: 3}],
62
- * item => item.id === 2,
63
- * ); // => true
64
- * ```
65
- */
66
- export function exists<Item>(
67
- array: Item[],
68
- filter: (item: Item, index: number, array: Item[]) => boolean,
69
- ): boolean;
70
-
71
- /**
72
- * Does the item exist in the array?
73
- *
74
- * @param array Array to search in
75
- * @param item Item to search for
76
- * @returns `true` if the item exists in the array, otherwise `false`
77
- *
78
- * @example
79
- * ```typescript
80
- * exists([1, 2, 3], 2); // => true
81
- * ```
82
- */
83
- export function exists<Item>(array: Item[], item: Item): boolean;
84
-
85
- export function exists(array: unknown[], ...parameters: unknown[]): boolean {
86
- if (parameters.length === 1 && typeof parameters[0] !== 'function') {
87
- return Array.isArray(array) ? array.includes(parameters[0]) : false;
88
- }
89
-
90
- return findValue(FIND_VALUE_INDEX, array, parameters, false) > -1;
91
- }
92
-
93
- // #endregion
@@ -1,182 +0,0 @@
1
- import {FIND_VALUES_ALL, findValues} from '../internal/array/find';
2
- import type {PlainObject} from '../models';
3
-
4
- // #region Functions
5
-
6
- /**
7
- * Get a filtered array of items that do not match the value
8
- *
9
- * _Available as `exclude` and `filter.remove`_
10
- *
11
- * @param array Array to search in
12
- * @param callback Callback to get an item's value for matching
13
- * @param value Value to match against
14
- * @returns Filtered array of items that do not match the filter
15
- *
16
- * @example
17
- * ```typescript
18
- * exclude(
19
- * [{id: 1}, {id: 2}, {id: 3}],
20
- * item => item.id,
21
- * 2,
22
- * ); // => [{id: 1}, {id: 3}]
23
- * ```
24
- */
25
- export function exclude<
26
- Item,
27
- Callback extends (item: Item, index: number, array: Item[]) => unknown,
28
- >(array: Item[], callback: Callback, value: ReturnType<Callback>): unknown[];
29
-
30
- /**
31
- * Get a filtered array of items that do not match the value
32
- *
33
- * _Available as `exclude` and `filter.remove`_
34
- *
35
- * @param array Array to search in
36
- * @param key Key to get an item's value for matching
37
- * @param value Value to match against
38
- * @returns Filtered array of items that do not match the filter
39
- *
40
- * @example
41
- * ```typescript
42
- * exclude(
43
- * [{id: 1}, {id: 2}, {id: 3}],
44
- * 'id',
45
- * 2,
46
- * ); // => [{id: 1}, {id: 3}]
47
- * ```
48
- */
49
- export function exclude<Item extends PlainObject, ItemKey extends keyof Item>(
50
- array: Item[],
51
- key: ItemKey,
52
- value: Item[ItemKey],
53
- ): unknown[];
54
-
55
- /**
56
- * Get a filtered array of items that do not match the filter
57
- *
58
- * _Available as `exclude` and `filter.remove`_
59
- *
60
- * @param array Array to search in
61
- * @param filter Filter callback to match items
62
- * @returns Filtered array of items that do not match the filter
63
- *
64
- * @example
65
- * ```typescript
66
- * exclude(
67
- * [{id: 1}, {id: 2}, {id: 3}],
68
- * item => item.id === 2,
69
- * ); // => [{id: 1}, {id: 3}]
70
- * ```
71
- */
72
- export function exclude<Item>(
73
- array: Item[],
74
- filter: (item: Item, index: number, array: Item[]) => boolean,
75
- ): unknown[];
76
-
77
- /**
78
- * Get a filtered array of items that do not match the given item
79
- *
80
- * _Available as `exclude` and `filter.remove`_
81
- *
82
- * @param array Array to search in
83
- * @param item Item to match against
84
- * @returns Filtered array of items that do not match the given item
85
- *
86
- * @example
87
- * ```typescript
88
- * exclude([1, 2, 3], 2); // => [1, 3]
89
- * ```
90
- */
91
- export function exclude<Item>(array: Item[], item: Item): unknown[];
92
-
93
- export function exclude(array: unknown[], ...parameters: unknown[]): unknown[] {
94
- return findValues(FIND_VALUES_ALL, array, parameters).notMatched;
95
- }
96
-
97
- /**
98
- * Get a filtered array of items
99
- *
100
- * @param array Array to search in
101
- * @param callback Callback to get an item's value for matching
102
- * @param value Value to match against
103
- * @returns Filtered array of items
104
- *
105
- * @example
106
- * ```typescript
107
- * filter(
108
- * [{id: 1}, {id: 2}, {id: 3}],
109
- * item => item.id,
110
- * 2,
111
- * ); // => [{id: 2}]
112
- * ```
113
- */
114
- export function filter<
115
- Item,
116
- Callback extends (item: Item, index: number, array: Item[]) => unknown,
117
- >(array: Item[], callback: Callback, value: ReturnType<Callback>): Item[];
118
-
119
- /**
120
- * Get a filtered array of items
121
- *
122
- * @param array Array to search in
123
- * @param key Key to get an item's value for matching
124
- * @param value Value to match against
125
- * @returns Filtered array of items
126
- *
127
- * @example
128
- * ```typescript
129
- * filter(
130
- * [{id: 1}, {id: 2}, {id: 3}],
131
- * 'id',
132
- * 2,
133
- * ); // => [{id: 2}]
134
- * ```
135
- */
136
- export function filter<Item extends PlainObject, ItemKey extends keyof Item>(
137
- array: Item[],
138
- key: ItemKey,
139
- value: Item[ItemKey],
140
- ): Item[];
141
-
142
- /**
143
- * Get a filtered array of items matching the filter
144
- *
145
- * @param array Array to search in
146
- * @param filter Filter callback to match items
147
- * @returns Filtered array of items
148
- *
149
- * @example
150
- * ```typescript
151
- * filter(
152
- * [{id: 1}, {id: 2}, {id: 3}],
153
- * item => item.id === 2,
154
- * ); // => [{id: 2}]
155
- * ```
156
- */
157
- export function filter<Item>(
158
- array: Item[],
159
- filter: (item: Item, index: number, array: Item[]) => boolean,
160
- ): Item[];
161
-
162
- /**
163
- * Get a filtered array of items matching the given item
164
- *
165
- * @param array Array to search in
166
- * @param item Item to match against
167
- * @returns Filtered array of items
168
- *
169
- * @example
170
- * ```typescript
171
- * filter([1, 2, 3], 2); // => [2]
172
- * ```
173
- */
174
- export function filter<Item>(array: Item[], item: Item): Item[];
175
-
176
- export function filter(array: unknown[], ...parameters: unknown[]): unknown[] {
177
- return findValues(FIND_VALUES_ALL, array, parameters).matched;
178
- }
179
-
180
- filter.remove = exclude;
181
-
182
- // #endregion
package/src/array/find.ts DELETED
@@ -1,183 +0,0 @@
1
- import {FIND_VALUE_ITEM, findValue} from '../internal/array/find';
2
- import type {PlainObject} from '../models';
3
-
4
- // #region Functions
5
-
6
- /**
7
- * Get the first item matching the given value
8
- *
9
- * @param array Array to search in
10
- * @param callback Callback to get an item's value for matching
11
- * @param value Value to match against
12
- * @returns First item that matches the value, or `undefined` if no match is found
13
- *
14
- * @example
15
- * ```typescript
16
- * find(
17
- * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
18
- * item => item.value,
19
- * 10,
20
- * ); // => {id: 1, value: 10}
21
- * ```
22
- */
23
- export function find<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(
24
- array: Item[],
25
- callback: Callback,
26
- value: ReturnType<Callback>,
27
- ): Item | undefined;
28
-
29
- /**
30
- * Get the first item matching the given value by key
31
- *
32
- * @param array Array to search in
33
- * @param key Key to get an item's value for matching
34
- * @param value Value to match against
35
- * @returns First item that matches the value, or `undefined` if no match is found
36
- *
37
- * @example
38
- * ```typescript
39
- * find(
40
- * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
41
- * 'value',
42
- * 10,
43
- * ); // => {id: 1, value: 10}
44
- * ```
45
- */
46
- export function find<Item extends PlainObject, ItemKey extends keyof Item>(
47
- array: Item[],
48
- key: ItemKey,
49
- value: Item[ItemKey],
50
- ): Item | undefined;
51
-
52
- /**
53
- * Get the first item matching the filter
54
- *
55
- * @param array Array to search in
56
- * @param filter Filter callback to match items
57
- * @returns First item that matches the filter, or `undefined` if no match is found
58
- *
59
- * @example
60
- * ```typescript
61
- * find(
62
- * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
63
- * item => item.value === 10,
64
- * ); // => {id: 1, value: 10}
65
- * ```
66
- */
67
- export function find<Item>(
68
- array: Item[],
69
- filter: (item: Item, index: number, array: Item[]) => boolean,
70
- ): Item | undefined;
71
-
72
- /**
73
- * Get the first item matching the given value
74
- *
75
- * @param array Array to search in
76
- * @param value Value to match against
77
- * @returns First item that matches the value, or `undefined` if no match is found
78
- *
79
- * @example
80
- * ```typescript
81
- * find([1, 2, 3, 2, 1], 1); // => 1
82
- * ```
83
- */
84
- export function find<Item>(array: Item[], value: Item): Item | undefined;
85
-
86
- export function find(array: unknown[], ...parameters: unknown[]): unknown {
87
- return findValue(FIND_VALUE_ITEM, array, parameters, false);
88
- }
89
-
90
- find.last = findLast;
91
-
92
- /**
93
- * Get the last item matching the given value
94
- *
95
- * _Available as `findLast` and `find.last`_
96
- *
97
- * @param array Array to search in
98
- * @param callback Callback to get an item's value for matching
99
- * @param value Value to match against
100
- * @returns Last item that matches the value, or `undefined` if no match is found
101
- *
102
- * @example
103
- * ```typescript
104
- * findLast(
105
- * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
106
- * item => item.value,
107
- * 10,
108
- * ); // => {id: 3, value: 10}
109
- * ```
110
- */
111
- export function findLast<
112
- Item,
113
- Callback extends (item: Item, index: number, array: Item[]) => unknown,
114
- >(array: Item[], callback: Callback, value: ReturnType<Callback>): Item | undefined;
115
-
116
- /**
117
- * Get the last item matching the given value by key
118
- *
119
- * _Available as `findLast` and `find.last`_
120
- *
121
- * @param array Array to search in
122
- * @param key Key to get an item's value for matching
123
- * @param value Value to match against
124
- * @returns Last item that matches the value, or `undefined` if no match is found
125
- *
126
- * @example
127
- * ```typescript
128
- * findLast(
129
- * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
130
- * 'value',
131
- * 10,
132
- * ); // => {id: 3, value: 10}
133
- * ```
134
- */
135
- export function findLast<Item extends PlainObject, ItemKey extends keyof Item>(
136
- array: Item[],
137
- key: ItemKey,
138
- value: Item[ItemKey],
139
- ): Item | undefined;
140
-
141
- /**
142
- * Get the last item matching the filter
143
- *
144
- * _Available as `findLast` and `find.last`_
145
- *
146
- * @param array Array to search in
147
- * @param filter Filter callback to match items
148
- * @returns Last item that matches the filter, or `undefined` if no match is found
149
- *
150
- * @example
151
- * ```typescript
152
- * findLast(
153
- * [{id: 1, value: 10}, {id: 2, value: 20}, {id: 3, value: 10}],
154
- * item => item.value === 10,
155
- * ); // => {id: 3, value: 10}
156
- * ```
157
- */
158
- export function findLast<Item>(
159
- array: Item[],
160
- filter: (item: Item, index: number, array: Item[]) => boolean,
161
- ): Item | undefined;
162
-
163
- /**
164
- * Get the last item matching the given value
165
- *
166
- * _Available as `findLast` and `find.last`_
167
- *
168
- * @param array Array to search in
169
- * @param value Value to match against
170
- * @returns Last item that matches the value, or `undefined` if no match is found
171
- *
172
- * @example
173
- * ```typescript
174
- * findLast([1, 2, 3, 2, 1], 1); // => 1
175
- * ```
176
- */
177
- export function findLast<Item>(array: Item[], value: Item): Item | undefined;
178
-
179
- export function findLast(array: unknown[], ...parameters: unknown[]): unknown {
180
- return findValue(FIND_VALUE_ITEM, array, parameters, true);
181
- }
182
-
183
- // #endregion