@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.
Files changed (229) hide show
  1. package/dist/array/filter.d.mts +4 -4
  2. package/dist/array/find.d.mts +4 -4
  3. package/dist/array/first.d.mts +4 -4
  4. package/dist/array/get.d.mts +27 -1
  5. package/dist/array/get.mjs +5 -3
  6. package/dist/array/group-by.d.mts +6 -6
  7. package/dist/array/last.d.mts +4 -4
  8. package/dist/array/match.d.mts +7 -6
  9. package/dist/array/move.d.mts +7 -7
  10. package/dist/array/move.mjs +1 -1
  11. package/dist/array/select.d.mts +1 -0
  12. package/dist/array/slice.d.mts +3 -3
  13. package/dist/array/sort.d.mts +10 -7
  14. package/dist/array/sort.mjs +4 -3
  15. package/dist/array/swap.d.mts +1 -1
  16. package/dist/array/swap.mjs +1 -1
  17. package/dist/array/to-map.d.mts +32 -32
  18. package/dist/array/to-record.d.mts +6 -6
  19. package/dist/array/to-set.d.mts +6 -6
  20. package/dist/beacon.d.mts +6 -0
  21. package/dist/beacon.mjs +3 -0
  22. package/dist/color/index.d.mts +6 -2
  23. package/dist/color/index.mjs +6 -2
  24. package/dist/color/instance.d.mts +78 -14
  25. package/dist/color/instance.mjs +78 -14
  26. package/dist/color/misc/get.d.mts +39 -11
  27. package/dist/color/misc/get.mjs +39 -11
  28. package/dist/color/misc/is.d.mts +26 -11
  29. package/dist/color/misc/is.mjs +26 -11
  30. package/dist/color/misc/state.mjs +1 -1
  31. package/dist/color/models.d.mts +7 -4
  32. package/dist/color/space/hex.d.mts +15 -6
  33. package/dist/color/space/hex.mjs +15 -6
  34. package/dist/color/space/hsl.d.mts +10 -4
  35. package/dist/color/space/hsl.mjs +10 -4
  36. package/dist/color/space/rgb.d.mts +21 -12
  37. package/dist/color/space/rgb.mjs +21 -12
  38. package/dist/function/assert.d.mts +20 -14
  39. package/dist/function/assert.mjs +19 -13
  40. package/dist/function/limit.d.mts +8 -6
  41. package/dist/function/limit.mjs +8 -6
  42. package/dist/function/memoize.d.mts +15 -4
  43. package/dist/function/memoize.mjs +18 -4
  44. package/dist/function/once.d.mts +5 -3
  45. package/dist/function/once.mjs +5 -3
  46. package/dist/function/retry.d.mts +5 -2
  47. package/dist/function/retry.mjs +3 -1
  48. package/dist/function/work.d.mts +146 -98
  49. package/dist/{kalas.d.mts → herald.d.mts} +17 -8
  50. package/dist/{kalas.mjs → herald.mjs} +22 -13
  51. package/dist/index.d.mts +1464 -708
  52. package/dist/index.mjs +677 -324
  53. package/dist/internal/array/index-of.d.mts +4 -4
  54. package/dist/internal/array/insert.mjs +1 -1
  55. package/dist/internal/array/shuffle.d.mts +1 -0
  56. package/dist/internal/array/shuffle.mjs +2 -1
  57. package/dist/internal/is.d.mts +26 -8
  58. package/dist/internal/is.mjs +26 -8
  59. package/dist/internal/math/aggregate.d.mts +9 -9
  60. package/dist/internal/number.d.mts +13 -2
  61. package/dist/internal/number.mjs +13 -2
  62. package/dist/internal/random.d.mts +4 -2
  63. package/dist/internal/random.mjs +7 -5
  64. package/dist/internal/result.d.mts +17 -11
  65. package/dist/internal/result.mjs +10 -14
  66. package/dist/internal/string.d.mts +16 -1
  67. package/dist/internal/string.mjs +24 -1
  68. package/dist/internal/value/compare.d.mts +5 -2
  69. package/dist/internal/value/compare.mjs +5 -2
  70. package/dist/internal/value/equal.d.mts +12 -3
  71. package/dist/internal/value/equal.mjs +7 -4
  72. package/dist/internal/value/get.d.mts +17 -17
  73. package/dist/internal/value/has.d.mts +55 -11
  74. package/dist/internal/value/set.d.mts +24 -0
  75. package/dist/is.d.mts +12 -0
  76. package/dist/is.mjs +16 -1
  77. package/dist/logger.d.mts +7 -6
  78. package/dist/logger.mjs +6 -5
  79. package/dist/math.d.mts +36 -18
  80. package/dist/math.mjs +6 -3
  81. package/dist/models.d.mts +3 -3
  82. package/dist/promise/delay.d.mts +2 -0
  83. package/dist/promise/helpers.d.mts +6 -4
  84. package/dist/promise/helpers.mjs +6 -4
  85. package/dist/promise/index.d.mts +49 -38
  86. package/dist/promise/misc.d.mts +10 -7
  87. package/dist/promise/misc.mjs +4 -3
  88. package/dist/promise/models.d.mts +18 -19
  89. package/dist/promise/models.mjs +4 -3
  90. package/dist/promise/timed.d.mts +8 -6
  91. package/dist/query.d.mts +2 -0
  92. package/dist/query.mjs +2 -0
  93. package/dist/queue.d.mts +15 -4
  94. package/dist/queue.mjs +10 -3
  95. package/dist/random.d.mts +9 -2
  96. package/dist/random.mjs +7 -2
  97. package/dist/result/index.d.mts +14 -8
  98. package/dist/result/match.d.mts +18 -10
  99. package/dist/result/misc.d.mts +14 -7
  100. package/dist/result/misc.mjs +4 -2
  101. package/dist/result/models.d.mts +2 -0
  102. package/dist/result/work/flow.d.mts +86 -62
  103. package/dist/result/work/pipe.d.mts +55 -33
  104. package/dist/sized/map.d.mts +19 -16
  105. package/dist/sized/map.mjs +4 -4
  106. package/dist/sized/set.d.mts +20 -16
  107. package/dist/sized/set.mjs +8 -7
  108. package/dist/string/case.d.mts +8 -0
  109. package/dist/string/case.mjs +8 -0
  110. package/dist/string/fuzzy.d.mts +19 -5
  111. package/dist/string/fuzzy.mjs +7 -0
  112. package/dist/string/index.d.mts +17 -2
  113. package/dist/string/index.mjs +7 -9
  114. package/dist/string/match.d.mts +3 -0
  115. package/dist/string/match.mjs +3 -0
  116. package/dist/string/normalize.d.mts +6 -2
  117. package/dist/string/normalize.mjs +5 -2
  118. package/dist/string/template.d.mts +38 -9
  119. package/dist/string/template.mjs +19 -19
  120. package/dist/value/clone.d.mts +25 -4
  121. package/dist/value/clone.mjs +36 -22
  122. package/dist/value/collection.d.mts +9 -6
  123. package/dist/value/collection.mjs +3 -2
  124. package/dist/value/diff.d.mts +3 -1
  125. package/dist/value/diff.mjs +1 -0
  126. package/dist/value/freeze.d.mts +118 -9
  127. package/dist/value/freeze.mjs +56 -14
  128. package/dist/value/index.d.mts +1 -2
  129. package/dist/value/index.mjs +1 -2
  130. package/dist/value/merge.d.mts +11 -5
  131. package/dist/value/merge.mjs +2 -2
  132. package/dist/value/omit.d.mts +1 -0
  133. package/dist/value/omit.mjs +1 -0
  134. package/dist/value/pick.d.mts +1 -0
  135. package/dist/value/pick.mjs +1 -0
  136. package/dist/value/shake.d.mts +1 -0
  137. package/dist/value/shake.mjs +1 -0
  138. package/dist/value/smush.d.mts +1 -0
  139. package/dist/value/smush.mjs +1 -0
  140. package/dist/value/transform.d.mts +7 -3
  141. package/dist/value/unsmush.d.mts +1 -0
  142. package/dist/value/unsmush.mjs +1 -0
  143. package/package.json +11 -7
  144. package/src/array/filter.ts +4 -4
  145. package/src/array/find.ts +4 -4
  146. package/src/array/first.ts +4 -4
  147. package/src/array/get.ts +40 -5
  148. package/src/array/group-by.ts +6 -6
  149. package/src/array/last.ts +4 -4
  150. package/src/array/match.ts +7 -6
  151. package/src/array/move.ts +7 -7
  152. package/src/array/select.ts +1 -0
  153. package/src/array/slice.ts +3 -3
  154. package/src/array/sort.ts +15 -10
  155. package/src/array/swap.ts +1 -1
  156. package/src/array/to-map.ts +32 -32
  157. package/src/array/to-record.ts +6 -6
  158. package/src/array/to-set.ts +6 -6
  159. package/src/beacon.ts +6 -0
  160. package/src/color/index.ts +6 -2
  161. package/src/color/instance.ts +78 -14
  162. package/src/color/misc/get.ts +39 -11
  163. package/src/color/misc/is.ts +26 -11
  164. package/src/color/misc/state.ts +1 -1
  165. package/src/color/models.ts +7 -4
  166. package/src/color/space/hex.ts +15 -6
  167. package/src/color/space/hsl.ts +10 -4
  168. package/src/color/space/rgb.ts +21 -12
  169. package/src/function/assert.ts +20 -14
  170. package/src/function/limit.ts +8 -6
  171. package/src/function/memoize.ts +24 -5
  172. package/src/function/once.ts +5 -3
  173. package/src/function/retry.ts +7 -3
  174. package/src/function/work.ts +146 -98
  175. package/src/{kalas.ts → herald.ts} +23 -14
  176. package/src/index.ts +3 -2
  177. package/src/internal/array/index-of.ts +4 -4
  178. package/src/internal/array/insert.ts +1 -1
  179. package/src/internal/array/shuffle.ts +2 -1
  180. package/src/internal/is.ts +26 -8
  181. package/src/internal/math/aggregate.ts +9 -9
  182. package/src/internal/number.ts +13 -2
  183. package/src/internal/random.ts +10 -4
  184. package/src/internal/result.ts +30 -29
  185. package/src/internal/string.ts +28 -0
  186. package/src/internal/value/compare.ts +5 -2
  187. package/src/internal/value/equal.ts +13 -4
  188. package/src/internal/value/get.ts +17 -17
  189. package/src/internal/value/has.ts +54 -11
  190. package/src/internal/value/set.ts +24 -0
  191. package/src/is.ts +15 -1
  192. package/src/logger.ts +8 -7
  193. package/src/math.ts +36 -18
  194. package/src/models.ts +3 -3
  195. package/src/promise/delay.ts +2 -0
  196. package/src/promise/helpers.ts +6 -4
  197. package/src/promise/index.ts +49 -38
  198. package/src/promise/misc.ts +10 -7
  199. package/src/promise/models.ts +18 -19
  200. package/src/promise/timed.ts +8 -6
  201. package/src/query.ts +2 -0
  202. package/src/queue.ts +15 -4
  203. package/src/random.ts +8 -1
  204. package/src/result/index.ts +14 -8
  205. package/src/result/match.ts +18 -10
  206. package/src/result/misc.ts +17 -9
  207. package/src/result/models.ts +2 -0
  208. package/src/result/work/flow.ts +86 -62
  209. package/src/result/work/pipe.ts +55 -33
  210. package/src/sized/map.ts +20 -17
  211. package/src/sized/set.ts +21 -17
  212. package/src/string/case.ts +8 -0
  213. package/src/string/fuzzy.ts +19 -5
  214. package/src/string/index.ts +18 -15
  215. package/src/string/match.ts +3 -0
  216. package/src/string/normalize.ts +6 -2
  217. package/src/string/template.ts +69 -18
  218. package/src/value/clone.ts +51 -26
  219. package/src/value/collection.ts +9 -6
  220. package/src/value/diff.ts +3 -1
  221. package/src/value/freeze.ts +239 -25
  222. package/src/value/index.ts +0 -1
  223. package/src/value/merge.ts +11 -5
  224. package/src/value/omit.ts +1 -0
  225. package/src/value/pick.ts +1 -0
  226. package/src/value/shake.ts +1 -0
  227. package/src/value/smush.ts +1 -0
  228. package/src/value/transform.ts +7 -3
  229. package/src/value/unsmush.ts +1 -0
@@ -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 Map from an array of items using callbacks
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 Map of keyed values
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 Map from an array of items using a callback and value
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 Map of keyed values
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 Map from an array of items using a key and callback
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 Map of keyed values
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 Map from an array of items using a key and value
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 Map of keyed values
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 Map from an array of items using a callback
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 Map of keyed items
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 Map from an array of items using a key
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 Map of keyed items
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 Map from an array of items _(using indices as keys)_
121
+ * Create a _Map_ from an array of items _(using indices as keys)_
122
122
  *
123
123
  * @param array Array to convert
124
- * @returns Map of indiced items
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 Map from an array of items using callbacks, grouping values into arrays
138
+ * Create a _Map_ from an array of items using callbacks, grouping values into arrays
139
139
  *
140
- * Available as `toMapArrays` and `toMap.arrays`
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 Map of keyed arrays of values
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 Map from an array of items using a callback and value, grouping values into arrays
158
+ * Create a _Map_ from an array of items using a callback and value, grouping values into arrays
159
159
  *
160
- * Available as `toMapArrays` and `toMap.arrays`
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 Map of keyed arrays of values
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 Map from an array of items using a key and callback, grouping values into arrays
178
+ * Create a _Map_ from an array of items using a key and callback, grouping values into arrays
179
179
  *
180
- * Available as `toMapArrays` and `toMap.arrays`
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 Map of keyed arrays of values
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 Map from an array of items using a key and value, grouping values into arrays
198
+ * Create a _Map_ from an array of items using a key and value, grouping values into arrays
199
199
  *
200
- * Available as `toMapArrays` and `toMap.arrays`
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 Map of keyed arrays of values
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 Map from an array of items using a callback, grouping items into arrays
218
+ * Create a _Map_ from an array of items using a callback, grouping items into arrays
219
219
  *
220
- * Available as `toMapArrays` and `toMap.arrays`
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 Map of keyed arrays of items
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 Map from an array of items using a key, grouping items into arrays
236
+ * Create a _Map_ from an array of items using a key, grouping items into arrays
237
237
  *
238
- * Available as `toMapArrays` and `toMap.arrays`
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 Map of keyed arrays of items
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
- * Available as `toRecordArrays` and `toRecord.arrays`
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
- * Available as `toRecordArrays` and `toRecord.arrays`
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
- * Available as `toRecordArrays` and `toRecord.arrays`
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
- * Available as `toRecordArrays` and `toRecord.arrays`
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
- * Available as `toRecordArrays` and `toRecord.arrays`
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
- * Available as `toRecordArrays` and `toRecord.arrays`
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
@@ -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 Set from an array of items using a callback
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 Set of values
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 Set from an array of items using a key
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 Set of values
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 Set from an array of items
37
+ * Create a _Set_ from an array of items
38
38
  *
39
39
  * @param array Array to convert
40
- * @returns Set of items
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
@@ -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 Color from any kind of value
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 Color instance
17
+ * @returns _Color_ instance
14
18
  */
15
19
  declare function getColor(value: unknown): Color;
16
20
  //#endregion
@@ -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 Color from any kind of value
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 Color instance
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 colors from a hex color
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 colors and alpha from a hex color with an alpha channel
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 HSL color
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 HSL color
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 HSLA color
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 HSLA color
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 RGB color
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 RGB color
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 RGBA color
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 RGBA color
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