@oscarpalmer/atoms 0.186.2 → 0.187.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.
- package/dist/array/filter.d.mts +4 -4
- package/dist/array/find.d.mts +4 -4
- package/dist/array/first.d.mts +4 -4
- package/dist/array/get.d.mts +27 -1
- package/dist/array/get.mjs +5 -3
- package/dist/array/group-by.d.mts +6 -6
- package/dist/array/last.d.mts +4 -4
- package/dist/array/match.d.mts +7 -6
- package/dist/array/move.d.mts +7 -7
- package/dist/array/move.mjs +1 -1
- package/dist/array/select.d.mts +1 -0
- package/dist/array/slice.d.mts +3 -3
- package/dist/array/sort.d.mts +10 -7
- package/dist/array/sort.mjs +4 -3
- package/dist/array/swap.d.mts +1 -1
- package/dist/array/swap.mjs +1 -1
- package/dist/array/to-map.d.mts +32 -32
- package/dist/array/to-record.d.mts +6 -6
- package/dist/array/to-set.d.mts +6 -6
- package/dist/beacon.d.mts +6 -0
- package/dist/beacon.mjs +3 -0
- package/dist/color/index.d.mts +6 -2
- package/dist/color/index.mjs +6 -2
- package/dist/color/instance.d.mts +78 -14
- package/dist/color/instance.mjs +78 -14
- package/dist/color/misc/get.d.mts +39 -11
- package/dist/color/misc/get.mjs +39 -11
- package/dist/color/misc/is.d.mts +26 -11
- package/dist/color/misc/is.mjs +26 -11
- package/dist/color/misc/state.mjs +1 -1
- package/dist/color/models.d.mts +7 -4
- package/dist/color/space/hex.d.mts +15 -6
- package/dist/color/space/hex.mjs +15 -6
- package/dist/color/space/hsl.d.mts +10 -4
- package/dist/color/space/hsl.mjs +10 -4
- package/dist/color/space/rgb.d.mts +21 -12
- package/dist/color/space/rgb.mjs +21 -12
- package/dist/function/assert.d.mts +20 -14
- package/dist/function/assert.mjs +19 -13
- package/dist/function/limit.d.mts +8 -6
- package/dist/function/limit.mjs +8 -6
- package/dist/function/memoize.d.mts +15 -4
- package/dist/function/memoize.mjs +18 -4
- package/dist/function/once.d.mts +5 -3
- package/dist/function/once.mjs +5 -3
- package/dist/function/retry.d.mts +5 -2
- package/dist/function/retry.mjs +3 -1
- package/dist/function/work.d.mts +146 -98
- package/dist/{kalas.d.mts → herald.d.mts} +17 -8
- package/dist/{kalas.mjs → herald.mjs} +22 -13
- package/dist/index.d.mts +1464 -708
- package/dist/index.mjs +677 -324
- package/dist/internal/array/index-of.d.mts +4 -4
- package/dist/internal/array/insert.mjs +1 -1
- package/dist/internal/array/shuffle.d.mts +1 -0
- package/dist/internal/array/shuffle.mjs +2 -1
- package/dist/internal/is.d.mts +26 -8
- package/dist/internal/is.mjs +26 -8
- package/dist/internal/math/aggregate.d.mts +9 -9
- package/dist/internal/number.d.mts +13 -2
- package/dist/internal/number.mjs +13 -2
- package/dist/internal/random.d.mts +4 -2
- package/dist/internal/random.mjs +7 -5
- package/dist/internal/result.d.mts +17 -11
- package/dist/internal/result.mjs +10 -14
- package/dist/internal/string.d.mts +16 -1
- package/dist/internal/string.mjs +24 -1
- package/dist/internal/value/compare.d.mts +5 -2
- package/dist/internal/value/compare.mjs +5 -2
- package/dist/internal/value/equal.d.mts +12 -3
- package/dist/internal/value/equal.mjs +7 -4
- package/dist/internal/value/get.d.mts +17 -17
- package/dist/internal/value/has.d.mts +55 -11
- package/dist/internal/value/set.d.mts +24 -0
- package/dist/is.d.mts +12 -0
- package/dist/is.mjs +16 -1
- package/dist/logger.d.mts +7 -6
- package/dist/logger.mjs +6 -5
- package/dist/math.d.mts +36 -18
- package/dist/math.mjs +6 -3
- package/dist/models.d.mts +3 -3
- package/dist/promise/delay.d.mts +2 -0
- package/dist/promise/helpers.d.mts +6 -4
- package/dist/promise/helpers.mjs +6 -4
- package/dist/promise/index.d.mts +49 -38
- package/dist/promise/misc.d.mts +10 -7
- package/dist/promise/misc.mjs +4 -3
- package/dist/promise/models.d.mts +18 -19
- package/dist/promise/models.mjs +4 -3
- package/dist/promise/timed.d.mts +8 -6
- package/dist/query.d.mts +2 -0
- package/dist/query.mjs +2 -0
- package/dist/queue.d.mts +15 -4
- package/dist/queue.mjs +10 -3
- package/dist/random.d.mts +9 -2
- package/dist/random.mjs +7 -2
- package/dist/result/index.d.mts +14 -8
- package/dist/result/match.d.mts +18 -10
- package/dist/result/misc.d.mts +14 -7
- package/dist/result/misc.mjs +4 -2
- package/dist/result/models.d.mts +2 -0
- package/dist/result/work/flow.d.mts +86 -62
- package/dist/result/work/pipe.d.mts +55 -33
- package/dist/sized/map.d.mts +19 -16
- package/dist/sized/map.mjs +4 -4
- package/dist/sized/set.d.mts +20 -16
- package/dist/sized/set.mjs +8 -7
- package/dist/string/case.d.mts +8 -0
- package/dist/string/case.mjs +8 -0
- package/dist/string/fuzzy.d.mts +19 -5
- package/dist/string/fuzzy.mjs +7 -0
- package/dist/string/index.d.mts +17 -2
- package/dist/string/index.mjs +7 -9
- package/dist/string/match.d.mts +3 -0
- package/dist/string/match.mjs +3 -0
- package/dist/string/normalize.d.mts +6 -2
- package/dist/string/normalize.mjs +5 -2
- package/dist/string/template.d.mts +38 -9
- package/dist/string/template.mjs +19 -19
- package/dist/value/clone.d.mts +25 -4
- package/dist/value/clone.mjs +36 -22
- package/dist/value/collection.d.mts +9 -6
- package/dist/value/collection.mjs +3 -2
- package/dist/value/diff.d.mts +3 -1
- package/dist/value/diff.mjs +1 -0
- package/dist/value/freeze.d.mts +118 -9
- package/dist/value/freeze.mjs +56 -14
- package/dist/value/index.d.mts +1 -2
- package/dist/value/index.mjs +1 -2
- package/dist/value/merge.d.mts +11 -5
- package/dist/value/merge.mjs +2 -2
- package/dist/value/omit.d.mts +1 -0
- package/dist/value/omit.mjs +1 -0
- package/dist/value/pick.d.mts +1 -0
- package/dist/value/pick.mjs +1 -0
- package/dist/value/shake.d.mts +1 -0
- package/dist/value/shake.mjs +1 -0
- package/dist/value/smush.d.mts +1 -0
- package/dist/value/smush.mjs +1 -0
- package/dist/value/transform.d.mts +7 -3
- package/dist/value/unsmush.d.mts +1 -0
- package/dist/value/unsmush.mjs +1 -0
- package/package.json +11 -7
- package/src/array/filter.ts +4 -4
- package/src/array/find.ts +4 -4
- package/src/array/first.ts +4 -4
- package/src/array/get.ts +40 -5
- package/src/array/group-by.ts +6 -6
- package/src/array/last.ts +4 -4
- package/src/array/match.ts +7 -6
- package/src/array/move.ts +7 -7
- package/src/array/select.ts +1 -0
- package/src/array/slice.ts +3 -3
- package/src/array/sort.ts +15 -10
- package/src/array/swap.ts +1 -1
- package/src/array/to-map.ts +32 -32
- package/src/array/to-record.ts +6 -6
- package/src/array/to-set.ts +6 -6
- package/src/beacon.ts +6 -0
- package/src/color/index.ts +6 -2
- package/src/color/instance.ts +78 -14
- package/src/color/misc/get.ts +39 -11
- package/src/color/misc/is.ts +26 -11
- package/src/color/misc/state.ts +1 -1
- package/src/color/models.ts +7 -4
- package/src/color/space/hex.ts +15 -6
- package/src/color/space/hsl.ts +10 -4
- package/src/color/space/rgb.ts +21 -12
- package/src/function/assert.ts +20 -14
- package/src/function/limit.ts +8 -6
- package/src/function/memoize.ts +24 -5
- package/src/function/once.ts +5 -3
- package/src/function/retry.ts +7 -3
- package/src/function/work.ts +146 -98
- package/src/{kalas.ts → herald.ts} +23 -14
- package/src/index.ts +3 -2
- package/src/internal/array/index-of.ts +4 -4
- package/src/internal/array/insert.ts +1 -1
- package/src/internal/array/shuffle.ts +2 -1
- package/src/internal/is.ts +26 -8
- package/src/internal/math/aggregate.ts +9 -9
- package/src/internal/number.ts +13 -2
- package/src/internal/random.ts +10 -4
- package/src/internal/result.ts +30 -29
- package/src/internal/string.ts +28 -0
- package/src/internal/value/compare.ts +5 -2
- package/src/internal/value/equal.ts +13 -4
- package/src/internal/value/get.ts +17 -17
- package/src/internal/value/has.ts +54 -11
- package/src/internal/value/set.ts +24 -0
- package/src/is.ts +15 -1
- package/src/logger.ts +8 -7
- package/src/math.ts +36 -18
- package/src/models.ts +3 -3
- package/src/promise/delay.ts +2 -0
- package/src/promise/helpers.ts +6 -4
- package/src/promise/index.ts +49 -38
- package/src/promise/misc.ts +10 -7
- package/src/promise/models.ts +18 -19
- package/src/promise/timed.ts +8 -6
- package/src/query.ts +2 -0
- package/src/queue.ts +15 -4
- package/src/random.ts +8 -1
- package/src/result/index.ts +14 -8
- package/src/result/match.ts +18 -10
- package/src/result/misc.ts +17 -9
- package/src/result/models.ts +2 -0
- package/src/result/work/flow.ts +86 -62
- package/src/result/work/pipe.ts +55 -33
- package/src/sized/map.ts +20 -17
- package/src/sized/set.ts +21 -17
- package/src/string/case.ts +8 -0
- package/src/string/fuzzy.ts +19 -5
- package/src/string/index.ts +18 -15
- package/src/string/match.ts +3 -0
- package/src/string/normalize.ts +6 -2
- package/src/string/template.ts +69 -18
- package/src/value/clone.ts +51 -26
- package/src/value/collection.ts +9 -6
- package/src/value/diff.ts +3 -1
- package/src/value/freeze.ts +239 -25
- package/src/value/index.ts +0 -1
- package/src/value/merge.ts +11 -5
- package/src/value/omit.ts +1 -0
- package/src/value/pick.ts +1 -0
- package/src/value/shake.ts +1 -0
- package/src/value/smush.ts +1 -0
- package/src/value/transform.ts +7 -3
- package/src/value/unsmush.ts +1 -0
package/dist/array/to-map.d.mts
CHANGED
|
@@ -2,14 +2,14 @@ import { Key, PlainObject } from "../models.mjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/array/to-map.d.ts
|
|
4
4
|
/**
|
|
5
|
-
* Create a
|
|
5
|
+
* Create a _Map_ from an array of items using callbacks
|
|
6
6
|
*
|
|
7
7
|
* If multiple items have the same key, the latest item's value will be used
|
|
8
8
|
*
|
|
9
9
|
* @param array Array to convert
|
|
10
10
|
* @param key Callback to get an item's grouping key
|
|
11
11
|
* @param value Callback to get an item's value
|
|
12
|
-
* @returns
|
|
12
|
+
* @returns _Map_ of keyed values
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```typescript
|
|
@@ -22,14 +22,14 @@ import { Key, PlainObject } from "../models.mjs";
|
|
|
22
22
|
*/
|
|
23
23
|
declare function toMap<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Map<ReturnType<KeyCallback>, ReturnType<ValueCallback>>;
|
|
24
24
|
/**
|
|
25
|
-
* Create a
|
|
25
|
+
* Create a _Map_ from an array of items using a callback and value
|
|
26
26
|
*
|
|
27
27
|
* If multiple items have the same key, the latest item's value will be used
|
|
28
28
|
*
|
|
29
29
|
* @param array Array to convert
|
|
30
30
|
* @param key Callback to get an item's grouping key
|
|
31
31
|
* @param value Key to use for value
|
|
32
|
-
* @returns
|
|
32
|
+
* @returns _Map_ of keyed values
|
|
33
33
|
*
|
|
34
34
|
* @example
|
|
35
35
|
* ```typescript
|
|
@@ -42,14 +42,14 @@ declare function toMap<Item, KeyCallback extends (item: Item, index: number, arr
|
|
|
42
42
|
*/
|
|
43
43
|
declare function toMap<Item extends PlainObject, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ItemValue extends keyof Item>(array: Item[], key: KeyCallback, value: ItemValue): Map<ReturnType<KeyCallback>, Item[ItemValue]>;
|
|
44
44
|
/**
|
|
45
|
-
* Create a
|
|
45
|
+
* Create a _Map_ from an array of items using a key and callback
|
|
46
46
|
*
|
|
47
47
|
* If multiple items have the same key, the latest item's value will be used
|
|
48
48
|
*
|
|
49
49
|
* @param array Array to convert
|
|
50
50
|
* @param key Key to use for grouping
|
|
51
51
|
* @param value Callback to get an item's value
|
|
52
|
-
* @returns
|
|
52
|
+
* @returns _Map_ of keyed values
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```typescript
|
|
@@ -62,14 +62,14 @@ declare function toMap<Item extends PlainObject, KeyCallback extends (item: Item
|
|
|
62
62
|
*/
|
|
63
63
|
declare function toMap<Item extends PlainObject, ItemKey extends keyof Item, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, value: ValueCallback): Map<Item[ItemKey], ReturnType<ValueCallback>>;
|
|
64
64
|
/**
|
|
65
|
-
* Create a
|
|
65
|
+
* Create a _Map_ from an array of items using a key and value
|
|
66
66
|
*
|
|
67
67
|
* If multiple items have the same key, the latest item's value will be used
|
|
68
68
|
*
|
|
69
69
|
* @param array Array to convert
|
|
70
70
|
* @param key Key to use for grouping
|
|
71
71
|
* @param value Key to use for value
|
|
72
|
-
* @returns
|
|
72
|
+
* @returns _Map_ of keyed values
|
|
73
73
|
*
|
|
74
74
|
* @example
|
|
75
75
|
* ```typescript
|
|
@@ -82,13 +82,13 @@ declare function toMap<Item extends PlainObject, ItemKey extends keyof Item, Val
|
|
|
82
82
|
*/
|
|
83
83
|
declare function toMap<Item extends PlainObject, ItemKey extends keyof Item, ItemValue extends keyof Item>(array: Item[], key: ItemKey, value: ItemValue): Map<Item[ItemKey], Item[ItemValue]>;
|
|
84
84
|
/**
|
|
85
|
-
* Create a
|
|
85
|
+
* Create a _Map_ from an array of items using a callback
|
|
86
86
|
*
|
|
87
87
|
* If multiple items have the same key, the latest item will be used
|
|
88
88
|
*
|
|
89
89
|
* @param array Array to convert
|
|
90
90
|
* @param callback Callback to get an item's grouping key
|
|
91
|
-
* @returns
|
|
91
|
+
* @returns _Map_ of keyed items
|
|
92
92
|
*
|
|
93
93
|
* @example
|
|
94
94
|
* ```typescript
|
|
@@ -100,13 +100,13 @@ declare function toMap<Item extends PlainObject, ItemKey extends keyof Item, Ite
|
|
|
100
100
|
*/
|
|
101
101
|
declare function toMap<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], callback: Callback): Map<ReturnType<Callback>, Item>;
|
|
102
102
|
/**
|
|
103
|
-
* Create a
|
|
103
|
+
* Create a _Map_ from an array of items using a key
|
|
104
104
|
*
|
|
105
105
|
* If multiple items have the same key, the latest item will be used
|
|
106
106
|
*
|
|
107
107
|
* @param array Array to convert
|
|
108
108
|
* @param key Key to use for grouping
|
|
109
|
-
* @returns
|
|
109
|
+
* @returns _Map_ of keyed items
|
|
110
110
|
*
|
|
111
111
|
* @example
|
|
112
112
|
* ```typescript
|
|
@@ -118,10 +118,10 @@ declare function toMap<Item, Callback extends (item: Item, index: number, array:
|
|
|
118
118
|
*/
|
|
119
119
|
declare function toMap<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey): Map<Item[ItemKey], Item>;
|
|
120
120
|
/**
|
|
121
|
-
* Create a
|
|
121
|
+
* Create a _Map_ from an array of items _(using indices as keys)_
|
|
122
122
|
*
|
|
123
123
|
* @param array Array to convert
|
|
124
|
-
* @returns
|
|
124
|
+
* @returns _Map_ of indiced items
|
|
125
125
|
*
|
|
126
126
|
* @example
|
|
127
127
|
* ```typescript
|
|
@@ -135,14 +135,14 @@ declare namespace toMap {
|
|
|
135
135
|
var arrays: typeof toMapArrays;
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
|
-
* Create a
|
|
138
|
+
* Create a _Map_ from an array of items using callbacks, grouping values into arrays
|
|
139
139
|
*
|
|
140
|
-
*
|
|
140
|
+
* _Available as `toMapArrays` and `toMap.arrays`_
|
|
141
141
|
*
|
|
142
142
|
* @param array Array to convert
|
|
143
143
|
* @param key Callback to get an item's grouping key
|
|
144
144
|
* @param value Callback to get an item's value
|
|
145
|
-
* @returns
|
|
145
|
+
* @returns _Map_ of keyed arrays of values
|
|
146
146
|
*
|
|
147
147
|
* @example
|
|
148
148
|
* ```typescript
|
|
@@ -155,14 +155,14 @@ declare namespace toMap {
|
|
|
155
155
|
*/
|
|
156
156
|
declare function toMapArrays<Item, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: KeyCallback, value: ValueCallback): Map<ReturnType<KeyCallback>, ReturnType<ValueCallback>[]>;
|
|
157
157
|
/**
|
|
158
|
-
* Create a
|
|
158
|
+
* Create a _Map_ from an array of items using a callback and value, grouping values into arrays
|
|
159
159
|
*
|
|
160
|
-
*
|
|
160
|
+
* _Available as `toMapArrays` and `toMap.arrays`_
|
|
161
161
|
*
|
|
162
162
|
* @param array Array to convert
|
|
163
163
|
* @param key Callback to get an item's grouping key
|
|
164
164
|
* @param value Key to use for value
|
|
165
|
-
* @returns
|
|
165
|
+
* @returns _Map_ of keyed arrays of values
|
|
166
166
|
*
|
|
167
167
|
* @example
|
|
168
168
|
* ```typescript
|
|
@@ -175,14 +175,14 @@ declare function toMapArrays<Item, KeyCallback extends (item: Item, index: numbe
|
|
|
175
175
|
*/
|
|
176
176
|
declare function toMapArrays<Item extends PlainObject, KeyCallback extends (item: Item, index: number, array: Item[]) => Key, ItemValue extends keyof Item>(array: Item[], key: KeyCallback, value: ItemValue): Map<ReturnType<KeyCallback>, Item[ItemValue][]>;
|
|
177
177
|
/**
|
|
178
|
-
* Create a
|
|
178
|
+
* Create a _Map_ from an array of items using a key and callback, grouping values into arrays
|
|
179
179
|
*
|
|
180
|
-
*
|
|
180
|
+
* _Available as `toMapArrays` and `toMap.arrays`_
|
|
181
181
|
*
|
|
182
182
|
* @param array Array to convert
|
|
183
183
|
* @param key Key to use for grouping
|
|
184
184
|
* @param value Callback to get an item's value
|
|
185
|
-
* @returns
|
|
185
|
+
* @returns _Map_ of keyed arrays of values
|
|
186
186
|
*
|
|
187
187
|
* @example
|
|
188
188
|
* ```typescript
|
|
@@ -195,14 +195,14 @@ declare function toMapArrays<Item extends PlainObject, KeyCallback extends (item
|
|
|
195
195
|
*/
|
|
196
196
|
declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Item, ValueCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], key: ItemKey, value: ValueCallback): Map<Item[ItemKey], ReturnType<ValueCallback>[]>;
|
|
197
197
|
/**
|
|
198
|
-
* Create a
|
|
198
|
+
* Create a _Map_ from an array of items using a key and value, grouping values into arrays
|
|
199
199
|
*
|
|
200
|
-
*
|
|
200
|
+
* _Available as `toMapArrays` and `toMap.arrays`_
|
|
201
201
|
*
|
|
202
202
|
* @param array Array to convert
|
|
203
203
|
* @param key Key to use for grouping
|
|
204
204
|
* @param value Key to use for value
|
|
205
|
-
* @returns
|
|
205
|
+
* @returns _Map_ of keyed arrays of values
|
|
206
206
|
*
|
|
207
207
|
* @example
|
|
208
208
|
* ```typescript
|
|
@@ -215,13 +215,13 @@ declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Ite
|
|
|
215
215
|
*/
|
|
216
216
|
declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Item, ItemValue extends keyof Item>(array: Item[], key: ItemKey, value: ItemValue): Map<Item[ItemKey], Item[ItemValue][]>;
|
|
217
217
|
/**
|
|
218
|
-
* Create a
|
|
218
|
+
* Create a _Map_ from an array of items using a callback, grouping items into arrays
|
|
219
219
|
*
|
|
220
|
-
*
|
|
220
|
+
* _Available as `toMapArrays` and `toMap.arrays`_
|
|
221
221
|
*
|
|
222
222
|
* @param array Array to convert
|
|
223
223
|
* @param callback Callback to get an item's grouping key
|
|
224
|
-
* @returns
|
|
224
|
+
* @returns _Map_ of keyed arrays of items
|
|
225
225
|
*
|
|
226
226
|
* @example
|
|
227
227
|
* ```typescript
|
|
@@ -233,13 +233,13 @@ declare function toMapArrays<Item extends PlainObject, ItemKey extends keyof Ite
|
|
|
233
233
|
*/
|
|
234
234
|
declare function toMapArrays<Item, Callback extends (item: Item, index: number, array: Item[]) => Key>(array: Item[], callback: Callback): Map<ReturnType<Callback>, Item[]>;
|
|
235
235
|
/**
|
|
236
|
-
* Create a
|
|
236
|
+
* Create a _Map_ from an array of items using a key, grouping items into arrays
|
|
237
237
|
*
|
|
238
|
-
*
|
|
238
|
+
* _Available as `toMapArrays` and `toMap.arrays`_
|
|
239
239
|
*
|
|
240
240
|
* @param array Array to convert
|
|
241
241
|
* @param key Key to use for grouping
|
|
242
|
-
* @returns
|
|
242
|
+
* @returns _Map_ of keyed arrays of items
|
|
243
243
|
*
|
|
244
244
|
* @example
|
|
245
245
|
* ```typescript
|
|
@@ -137,7 +137,7 @@ declare namespace toRecord {
|
|
|
137
137
|
/**
|
|
138
138
|
* Create a record from an array of items using callbacks, grouping values into arrays
|
|
139
139
|
*
|
|
140
|
-
*
|
|
140
|
+
* _Available as `toRecordArrays` and `toRecord.arrays`_
|
|
141
141
|
*
|
|
142
142
|
* @param array Array to convert
|
|
143
143
|
* @param key Callback to get an item's grouping key
|
|
@@ -157,7 +157,7 @@ declare function toRecordArrays<Item, KeyCallback extends (item: Item, index: nu
|
|
|
157
157
|
/**
|
|
158
158
|
* Create a record from an array of items using a callback and value, grouping values into arrays
|
|
159
159
|
*
|
|
160
|
-
*
|
|
160
|
+
* _Available as `toRecordArrays` and `toRecord.arrays`_
|
|
161
161
|
*
|
|
162
162
|
* @param array Array to convert
|
|
163
163
|
* @param callback Callback to get an item's grouping key
|
|
@@ -177,7 +177,7 @@ declare function toRecordArrays<Item extends PlainObject, Callback extends (item
|
|
|
177
177
|
/**
|
|
178
178
|
* Create a record from an array of items using a key and callback, grouping values into arrays
|
|
179
179
|
*
|
|
180
|
-
*
|
|
180
|
+
* _Available as `toRecordArrays` and `toRecord.arrays`_
|
|
181
181
|
*
|
|
182
182
|
* @param array Array to convert
|
|
183
183
|
* @param key Key to use for grouping
|
|
@@ -197,7 +197,7 @@ declare function toRecordArrays<Item extends PlainObject, ItemKey extends keyof
|
|
|
197
197
|
/**
|
|
198
198
|
* Create a record from an array of items using a key and value, grouping values into arrays
|
|
199
199
|
*
|
|
200
|
-
*
|
|
200
|
+
* _Available as `toRecordArrays` and `toRecord.arrays`_
|
|
201
201
|
*
|
|
202
202
|
* @param array Array to convert
|
|
203
203
|
* @param key Key to use for grouping
|
|
@@ -217,7 +217,7 @@ declare function toRecordArrays<Item extends PlainObject, ItemKey extends keyof
|
|
|
217
217
|
/**
|
|
218
218
|
* Create a record from an array of items using a callback, grouping items into arrays
|
|
219
219
|
*
|
|
220
|
-
*
|
|
220
|
+
* _Available as `toRecordArrays` and `toRecord.arrays`_
|
|
221
221
|
*
|
|
222
222
|
* @param array Array to convert
|
|
223
223
|
* @param callback Callback to get an item's grouping key
|
|
@@ -235,7 +235,7 @@ declare function toRecordArrays<Item, Callback extends (item: Item, index: numbe
|
|
|
235
235
|
/**
|
|
236
236
|
* Create a record from an array of items using a key, grouping items into arrays
|
|
237
237
|
*
|
|
238
|
-
*
|
|
238
|
+
* _Available as `toRecordArrays` and `toRecord.arrays`_
|
|
239
239
|
*
|
|
240
240
|
* @param array Array to convert
|
|
241
241
|
* @param key Key to use for grouping
|
package/dist/array/to-set.d.mts
CHANGED
|
@@ -2,11 +2,11 @@ import { PlainObject } from "../models.mjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/array/to-set.d.ts
|
|
4
4
|
/**
|
|
5
|
-
* Create a
|
|
5
|
+
* Create a _Set_ from an array of items using a callback
|
|
6
6
|
*
|
|
7
7
|
* @param array Array to convert
|
|
8
8
|
* @param callback Callback to get an item's value
|
|
9
|
-
* @returns
|
|
9
|
+
* @returns _Set_ of values
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
@@ -18,11 +18,11 @@ import { PlainObject } from "../models.mjs";
|
|
|
18
18
|
*/
|
|
19
19
|
declare function toSet<Item, Callback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], callback: Callback): Set<ReturnType<Callback>>;
|
|
20
20
|
/**
|
|
21
|
-
* Create a
|
|
21
|
+
* Create a _Set_ from an array of items using a key
|
|
22
22
|
*
|
|
23
23
|
* @param array Array to convert
|
|
24
24
|
* @param key Key to use for value
|
|
25
|
-
* @returns
|
|
25
|
+
* @returns _Set_ of values
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
28
|
* ```typescript
|
|
@@ -34,10 +34,10 @@ declare function toSet<Item, Callback extends (item: Item, index: number, array:
|
|
|
34
34
|
*/
|
|
35
35
|
declare function toSet<Item extends PlainObject, ItemKey extends keyof Item>(array: Item[], key: ItemKey): Set<Item[ItemKey]>;
|
|
36
36
|
/**
|
|
37
|
-
* Create a
|
|
37
|
+
* Create a _Set_ from an array of items
|
|
38
38
|
*
|
|
39
39
|
* @param array Array to convert
|
|
40
|
-
* @returns
|
|
40
|
+
* @returns _Set_ of items
|
|
41
41
|
*
|
|
42
42
|
* @example
|
|
43
43
|
* ```typescript
|
package/dist/beacon.d.mts
CHANGED
|
@@ -23,12 +23,14 @@ declare class Beacon<Value> {
|
|
|
23
23
|
destroy(): void;
|
|
24
24
|
/**
|
|
25
25
|
* Emit a new value
|
|
26
|
+
*
|
|
26
27
|
* @param value Value to set and emit
|
|
27
28
|
* @param finish Finish the beacon after emitting? _(defaults to `false`)_
|
|
28
29
|
*/
|
|
29
30
|
emit(value: Value, finish?: boolean): void;
|
|
30
31
|
/**
|
|
31
32
|
* Emit an error
|
|
33
|
+
*
|
|
32
34
|
* @param value Error to emit
|
|
33
35
|
* @param finish Finish the beacon after emitting? _(defaults to `false`)_
|
|
34
36
|
*/
|
|
@@ -44,6 +46,7 @@ declare class Beacon<Value> {
|
|
|
44
46
|
type BeaconOptions<Value> = {
|
|
45
47
|
/**
|
|
46
48
|
* Method for comparing values for equality
|
|
49
|
+
*
|
|
47
50
|
* @param first First value
|
|
48
51
|
* @param second Second value
|
|
49
52
|
* @returns `true` if the values are equal, otherwise `false`
|
|
@@ -63,6 +66,7 @@ declare class Observable<Value> {
|
|
|
63
66
|
destroy(): void;
|
|
64
67
|
/**
|
|
65
68
|
* Subscribe to value changes
|
|
69
|
+
*
|
|
66
70
|
* @param onNext Callback for when the observable receives a new value
|
|
67
71
|
* @param onError Callback for when the observable receives an error
|
|
68
72
|
* @param onComplete Callback for when the observable is completed
|
|
@@ -71,6 +75,7 @@ declare class Observable<Value> {
|
|
|
71
75
|
subscribe(onNext: (value: Value) => void, onError?: (error: Error) => void, onComplete?: () => void): Subscription<Value>;
|
|
72
76
|
/**
|
|
73
77
|
* Subscribe to value changes
|
|
78
|
+
*
|
|
74
79
|
* @param observer Observer for changes
|
|
75
80
|
* @returns Subscription to the observable
|
|
76
81
|
*/
|
|
@@ -119,6 +124,7 @@ declare class Subscription<Value> {
|
|
|
119
124
|
}
|
|
120
125
|
/**
|
|
121
126
|
* Create a new beacon
|
|
127
|
+
*
|
|
122
128
|
* @param value Initial value
|
|
123
129
|
* @param options Beacon options
|
|
124
130
|
* @returns Beacon instance
|
package/dist/beacon.mjs
CHANGED
|
@@ -44,6 +44,7 @@ var Beacon = class {
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Emit a new value
|
|
47
|
+
*
|
|
47
48
|
* @param value Value to set and emit
|
|
48
49
|
* @param finish Finish the beacon after emitting? _(defaults to `false`)_
|
|
49
50
|
*/
|
|
@@ -52,6 +53,7 @@ var Beacon = class {
|
|
|
52
53
|
}
|
|
53
54
|
/**
|
|
54
55
|
* Emit an error
|
|
56
|
+
*
|
|
55
57
|
* @param value Error to emit
|
|
56
58
|
* @param finish Finish the beacon after emitting? _(defaults to `false`)_
|
|
57
59
|
*/
|
|
@@ -136,6 +138,7 @@ var Subscription = class {
|
|
|
136
138
|
};
|
|
137
139
|
/**
|
|
138
140
|
* Create a new beacon
|
|
141
|
+
*
|
|
139
142
|
* @param value Initial value
|
|
140
143
|
* @param options Beacon options
|
|
141
144
|
* @returns Beacon instance
|
package/dist/color/index.d.mts
CHANGED
|
@@ -8,9 +8,13 @@ import { rgbToHex, rgbToHsl, rgbToHsla } from "./space/rgb.mjs";
|
|
|
8
8
|
|
|
9
9
|
//#region src/color/index.d.ts
|
|
10
10
|
/**
|
|
11
|
-
* Get a
|
|
11
|
+
* Get a _Color_ from any kind of value
|
|
12
|
+
*
|
|
13
|
+
* - Values that can be parsed are: hex(a) color strings, _HSL(A)_ color objects, and _RGB(A)_ color objects
|
|
14
|
+
* - If the value is unable to be parsed, a black _Color_ will be returned
|
|
15
|
+
*
|
|
12
16
|
* @param value Original value
|
|
13
|
-
* @returns
|
|
17
|
+
* @returns _Color_ instance
|
|
14
18
|
*/
|
|
15
19
|
declare function getColor(value: unknown): Color;
|
|
16
20
|
//#endregion
|
package/dist/color/index.mjs
CHANGED
|
@@ -6,9 +6,13 @@ import { hslToHex, hslToRgb, hslToRgba } from "./space/hsl.mjs";
|
|
|
6
6
|
import { Color } from "./instance.mjs";
|
|
7
7
|
//#region src/color/index.ts
|
|
8
8
|
/**
|
|
9
|
-
* Get a
|
|
9
|
+
* Get a _Color_ from any kind of value
|
|
10
|
+
*
|
|
11
|
+
* - Values that can be parsed are: hex(a) color strings, _HSL(A)_ color objects, and _RGB(A)_ color objects
|
|
12
|
+
* - If the value is unable to be parsed, a black _Color_ will be returned
|
|
13
|
+
*
|
|
10
14
|
* @param value Original value
|
|
11
|
-
* @returns
|
|
15
|
+
* @returns _Color_ instance
|
|
12
16
|
*/
|
|
13
17
|
function getColor(value) {
|
|
14
18
|
return isColor(value) ? value : new Color(value);
|
|
@@ -13,65 +13,129 @@ declare class Color {
|
|
|
13
13
|
*/
|
|
14
14
|
private readonly $color;
|
|
15
15
|
/**
|
|
16
|
-
* Get the alpha channel
|
|
16
|
+
* Get the alpha channel _(opacity)_ of the color
|
|
17
|
+
*
|
|
18
|
+
* @returns Current alpha channel value between `0` and `1`
|
|
17
19
|
*/
|
|
18
20
|
get alpha(): number;
|
|
19
21
|
/**
|
|
20
|
-
* Set the alpha channel
|
|
22
|
+
* Set the alpha channel _(opacity)_ of the color, as:
|
|
23
|
+
*
|
|
24
|
+
* - A number between `0` and `1`, where `0` is fully transparent and `1` is fully opaque
|
|
25
|
+
* - A number between `0` and `100`, where `0` is fully transparent and `100` is fully opaque
|
|
26
|
+
*
|
|
27
|
+
* @param value New alpha channel value
|
|
21
28
|
*/
|
|
22
29
|
set alpha(value: number);
|
|
23
30
|
/**
|
|
24
|
-
* Get the color as a hex color
|
|
31
|
+
* Get the color as a hex color string
|
|
32
|
+
*
|
|
33
|
+
* _Hex color string is returned with no `#`-prefix or alpha channel (opacity)_
|
|
34
|
+
*
|
|
35
|
+
* @returns Current color as a hex color string
|
|
25
36
|
*/
|
|
26
37
|
get hex(): string;
|
|
27
38
|
/**
|
|
28
|
-
* Set
|
|
39
|
+
* Set the color from a hex color string
|
|
40
|
+
*
|
|
41
|
+
* - `#`-prefix is optional
|
|
42
|
+
* - Alpha channel _(opacity)_ will be ignored
|
|
43
|
+
*
|
|
44
|
+
* @param value New hex color string
|
|
29
45
|
*/
|
|
30
46
|
set hex(value: string);
|
|
31
47
|
/**
|
|
32
|
-
* Get the color as a hex color with an alpha channel
|
|
48
|
+
* Get the color as a hex color with an alpha channel _(opacity)_
|
|
49
|
+
*
|
|
50
|
+
* _Hex color string is returned with alpha channel (opacity), but without `#`-prefix_
|
|
51
|
+
*
|
|
52
|
+
* @returns Current color as a hex color string
|
|
33
53
|
*/
|
|
34
54
|
get hexa(): string;
|
|
35
55
|
/**
|
|
36
|
-
* Set
|
|
56
|
+
* Set the color from a hex color string with an alpha channel _(opacity)_
|
|
57
|
+
*
|
|
58
|
+
* - `#`-prefix is optional
|
|
59
|
+
* - Alpha channel _(opacity)_ will be respected
|
|
60
|
+
*
|
|
61
|
+
* @param value New hex color string
|
|
37
62
|
*/
|
|
38
63
|
set hexa(value: string);
|
|
39
64
|
/**
|
|
40
|
-
* Get the color as an
|
|
65
|
+
* Get the color as an _HSL_ color
|
|
66
|
+
*
|
|
67
|
+
* @returns Current color as an _HSL_ color
|
|
41
68
|
*/
|
|
42
69
|
get hsl(): HSLColor;
|
|
43
70
|
/**
|
|
44
|
-
* Set colors from an
|
|
71
|
+
* Set colors from an _HSL_ color
|
|
72
|
+
*
|
|
73
|
+
* @param value New _HSL_ color
|
|
45
74
|
*/
|
|
46
75
|
set hsl(value: HSLColor);
|
|
47
76
|
/**
|
|
48
|
-
* Get the color as an
|
|
77
|
+
* Get the color as an _HSLA_ color
|
|
78
|
+
*
|
|
79
|
+
* @returns Current color as an _HSLA_ color
|
|
49
80
|
*/
|
|
50
81
|
get hsla(): HSLAColor;
|
|
51
82
|
/**
|
|
52
|
-
* Set colors and alpha from an
|
|
83
|
+
* Set colors and alpha from an _HSLA_ color
|
|
84
|
+
*
|
|
85
|
+
* @param value New _HSLA_ color
|
|
53
86
|
*/
|
|
54
87
|
set hsla(value: HSLAColor);
|
|
55
88
|
/**
|
|
56
|
-
* Get the color as an
|
|
89
|
+
* Get the color as an _RGB_ color
|
|
90
|
+
*
|
|
91
|
+
* @returns Current color as an _RGB_ color
|
|
57
92
|
*/
|
|
58
93
|
get rgb(): RGBColor;
|
|
59
94
|
/**
|
|
60
|
-
* Set colors from an
|
|
95
|
+
* Set colors from an _RGB_ color
|
|
96
|
+
*
|
|
97
|
+
* @param value New _RGB_ color
|
|
61
98
|
*/
|
|
62
99
|
set rgb(value: RGBColor);
|
|
63
100
|
/**
|
|
64
|
-
* Get the color as an
|
|
101
|
+
* Get the color as an _RGBA_ color
|
|
102
|
+
*
|
|
103
|
+
* @returns Current color as an _RGBA_ color
|
|
65
104
|
*/
|
|
66
105
|
get rgba(): RGBAColor;
|
|
67
106
|
/**
|
|
68
|
-
* Set colors and alpha from an
|
|
107
|
+
* Set colors and alpha from an _RGBA_ color
|
|
108
|
+
*
|
|
109
|
+
* @param value New _RGBA_ color
|
|
69
110
|
*/
|
|
70
111
|
set rgba(value: RGBAColor);
|
|
71
112
|
constructor(value: unknown);
|
|
113
|
+
/**
|
|
114
|
+
* Get the color as a hex string
|
|
115
|
+
*
|
|
116
|
+
* @param alpha Include alpha channel _(opacity)_? _(defaults to `false`)_
|
|
117
|
+
* @returns Hex color string
|
|
118
|
+
*/
|
|
72
119
|
toHexString(alpha?: boolean): string;
|
|
120
|
+
/**
|
|
121
|
+
* Get the color as an _HSL(A)_ string
|
|
122
|
+
*
|
|
123
|
+
* @param alpha Include alpha channel _(opacity)_? _(defaults to `false`)_
|
|
124
|
+
* @returns _HSL(A)_ color string
|
|
125
|
+
*/
|
|
73
126
|
toHslString(alpha?: boolean): string;
|
|
127
|
+
/**
|
|
128
|
+
* Get the color as an _RGB(A)_ string
|
|
129
|
+
*
|
|
130
|
+
* @param alpha Include alpha channel _(opacity)_? _(defaults to `false`)_
|
|
131
|
+
* @returns _RGB(A)_ color string
|
|
132
|
+
*/
|
|
74
133
|
toRgbString(alpha?: boolean): string;
|
|
134
|
+
/**
|
|
135
|
+
* Get the color as a hex color string
|
|
136
|
+
*
|
|
137
|
+
* @returns Hex color string
|
|
138
|
+
*/
|
|
75
139
|
toString(): string;
|
|
76
140
|
}
|
|
77
141
|
//#endregion
|