@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
@@ -17,9 +17,10 @@ type WrapValue<Value> = Result<UnwrapValue<Value>>;
17
17
  /**
18
18
  * Attempt to pipe a value through a function
19
19
  *
20
- * Available as `attemptAsyncPipe` and `attemptPipe.async`
20
+ * _Available as `attemptAsyncPipe` and `attemptPipe.async`_
21
+ *
21
22
  * @param initial Initial value
22
- * @returns Piped result
23
+ * @returns _Piped_ result
23
24
  */
24
25
  export async function attemptAsyncPipe<Initial, Piped>(
25
26
  initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
@@ -29,9 +30,10 @@ export async function attemptAsyncPipe<Initial, Piped>(
29
30
  /**
30
31
  * Attempt to pipe a value through a series of functions
31
32
  *
32
- * Available as `attemptAsyncPipe` and `attemptPipe.async`
33
+ * _Available as `attemptAsyncPipe` and `attemptPipe.async`_
34
+ *
33
35
  * @param initial Initial value
34
- * @returns Piped result
36
+ * @returns _Piped_ result
35
37
  */
36
38
  export async function attemptAsyncPipe<Initial, First, Second>(
37
39
  initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
@@ -42,9 +44,10 @@ export async function attemptAsyncPipe<Initial, First, Second>(
42
44
  /**
43
45
  * Attempt to pipe a value through a series of functions
44
46
  *
45
- * Available as `attemptAsyncPipe` and `attemptPipe.async`
47
+ * _Available as `attemptAsyncPipe` and `attemptPipe.async`_
48
+ *
46
49
  * @param initial Initial value
47
- * @returns Piped result
50
+ * @returns _Piped_ result
48
51
  */
49
52
  export async function attemptAsyncPipe<Initial, First, Second, Third>(
50
53
  initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
@@ -56,9 +59,10 @@ export async function attemptAsyncPipe<Initial, First, Second, Third>(
56
59
  /**
57
60
  * Attempt to pipe a value through a series of functions
58
61
  *
59
- * Available as `attemptAsyncPipe` and `attemptPipe.async`
62
+ * _Available as `attemptAsyncPipe` and `attemptPipe.async`_
63
+ *
60
64
  * @param initial Initial value
61
- * @returns Piped result
65
+ * @returns _Piped_ result
62
66
  */
63
67
  export async function attemptAsyncPipe<Initial, First, Second, Third, Fourth>(
64
68
  initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
@@ -71,9 +75,10 @@ export async function attemptAsyncPipe<Initial, First, Second, Third, Fourth>(
71
75
  /**
72
76
  * Attempt to pipe a value through a series of functions
73
77
  *
74
- * Available as `attemptAsyncPipe` and `attemptPipe.async`
78
+ * _Available as `attemptAsyncPipe` and `attemptPipe.async`_
79
+ *
75
80
  * @param initial Initial value
76
- * @returns Piped result
81
+ * @returns _Piped_ result
77
82
  */
78
83
  export async function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth>(
79
84
  initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
@@ -87,9 +92,10 @@ export async function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fi
87
92
  /**
88
93
  * Attempt to pipe a value through a series of functions
89
94
  *
90
- * Available as `attemptAsyncPipe` and `attemptPipe.async`
95
+ * _Available as `attemptAsyncPipe` and `attemptPipe.async`_
96
+ *
91
97
  * @param initial Initial value
92
- * @returns Piped result
98
+ * @returns _Piped_ result
93
99
  */
94
100
  export async function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(
95
101
  initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
@@ -104,9 +110,10 @@ export async function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fi
104
110
  /**
105
111
  * Attempt to pipe a value through a series of functions
106
112
  *
107
- * Available as `attemptAsyncPipe` and `attemptPipe.async`
113
+ * _Available as `attemptAsyncPipe` and `attemptPipe.async`_
114
+ *
108
115
  * @param initial Initial value
109
- * @returns Piped result
116
+ * @returns _Piped_ result
110
117
  */
111
118
  export async function attemptAsyncPipe<
112
119
  Initial,
@@ -131,9 +138,10 @@ export async function attemptAsyncPipe<
131
138
  /**
132
139
  * Attempt to pipe a value through a series of functions
133
140
  *
134
- * Available as `attemptAsyncPipe` and `attemptPipe.async`
141
+ * _Available as `attemptAsyncPipe` and `attemptPipe.async`_
142
+ *
135
143
  * @param initial Initial value
136
- * @returns Piped result
144
+ * @returns _Piped_ result
137
145
  */
138
146
  export async function attemptAsyncPipe<
139
147
  Initial,
@@ -160,9 +168,10 @@ export async function attemptAsyncPipe<
160
168
  /**
161
169
  * Attempt to pipe a value through a series of functions
162
170
  *
163
- * Available as `attemptAsyncPipe` and `attemptPipe.async`
171
+ * _Available as `attemptAsyncPipe` and `attemptPipe.async`_
172
+ *
164
173
  * @param initial Initial value
165
- * @returns Piped result
174
+ * @returns _Piped_ result
166
175
  */
167
176
  export async function attemptAsyncPipe<
168
177
  Initial,
@@ -191,9 +200,10 @@ export async function attemptAsyncPipe<
191
200
  /**
192
201
  * Attempt to pipe a value through a series of functions
193
202
  *
194
- * Available as `attemptAsyncPipe` and `attemptPipe.async`
203
+ * _Available as `attemptAsyncPipe` and `attemptPipe.async`_
204
+ *
195
205
  * @param initial Initial value
196
- * @returns Piped result
206
+ * @returns _Piped_ result
197
207
  */
198
208
  export async function attemptAsyncPipe<
199
209
  Initial,
@@ -224,9 +234,10 @@ export async function attemptAsyncPipe<
224
234
  /**
225
235
  * Attempt to pipe a result through a series of functions
226
236
  *
227
- * Available as `attemptAsyncPipe` and `attemptPipe.async`
237
+ * _Available as `attemptAsyncPipe` and `attemptPipe.async`_
238
+ *
228
239
  * @param initial Initial result
229
- * @returns Piped result
240
+ * @returns _Piped_ result
230
241
  */
231
242
  export async function attemptAsyncPipe<Initial>(
232
243
  initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
@@ -265,8 +276,9 @@ export async function attemptAsyncPipe(
265
276
 
266
277
  /**
267
278
  * Attempt to pipe a value through a function
279
+ *
268
280
  * @param initial Initial value
269
- * @returns Piped result
281
+ * @returns _Piped_ result
270
282
  */
271
283
  export function attemptPipe<Initial, Pipe>(
272
284
  initial: GenericCallback | Initial | Result<Initial>,
@@ -275,8 +287,9 @@ export function attemptPipe<Initial, Pipe>(
275
287
 
276
288
  /**
277
289
  * Attempt to pipe a value through a series of functions
290
+ *
278
291
  * @param initial Initial value
279
- * @returns Piped result
292
+ * @returns _Piped_ result
280
293
  */
281
294
  export function attemptPipe<Initial, First, Second>(
282
295
  initial: GenericCallback | Initial | Result<Initial>,
@@ -286,8 +299,9 @@ export function attemptPipe<Initial, First, Second>(
286
299
 
287
300
  /**
288
301
  * Attempt to pipe a value through a series of functions
302
+ *
289
303
  * @param initial Initial value
290
- * @returns Piped result
304
+ * @returns _Piped_ result
291
305
  */
292
306
  export function attemptPipe<Initial, First, Second, Third>(
293
307
  initial: GenericCallback | Initial | Result<Initial>,
@@ -298,8 +312,9 @@ export function attemptPipe<Initial, First, Second, Third>(
298
312
 
299
313
  /**
300
314
  * Attempt to pipe a value through a series of functions
315
+ *
301
316
  * @param initial Initial value
302
- * @returns Piped result
317
+ * @returns _Piped_ result
303
318
  */
304
319
  export function attemptPipe<Initial, First, Second, Third, Fourth>(
305
320
  initial: GenericCallback | Initial | Result<Initial>,
@@ -311,8 +326,9 @@ export function attemptPipe<Initial, First, Second, Third, Fourth>(
311
326
 
312
327
  /**
313
328
  * Attempt to pipe a value through a series of functions
329
+ *
314
330
  * @param initial Initial value
315
- * @returns Piped result
331
+ * @returns _Piped_ result
316
332
  */
317
333
  export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth>(
318
334
  initial: GenericCallback | Initial | Result<Initial>,
@@ -325,8 +341,9 @@ export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth>(
325
341
 
326
342
  /**
327
343
  * Attempt to pipe a value through a series of functions
344
+ *
328
345
  * @param initial Initial value
329
- * @returns Piped result
346
+ * @returns _Piped_ result
330
347
  */
331
348
  export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(
332
349
  initial: GenericCallback | Initial | Result<Initial>,
@@ -340,8 +357,9 @@ export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>
340
357
 
341
358
  /**
342
359
  * Attempt to pipe a value through a series of functions
360
+ *
343
361
  * @param initial Initial value
344
- * @returns Piped result
362
+ * @returns _Piped_ result
345
363
  */
346
364
  export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(
347
365
  initial: GenericCallback | Initial | Result<Initial>,
@@ -356,8 +374,9 @@ export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth,
356
374
 
357
375
  /**
358
376
  * Attempt to pipe a value through a series of functions
377
+ *
359
378
  * @param initial Initial value
360
- * @returns Piped result
379
+ * @returns _Piped_ result
361
380
  */
362
381
  export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(
363
382
  initial: GenericCallback | Initial | Result<Initial>,
@@ -373,8 +392,9 @@ export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth,
373
392
 
374
393
  /**
375
394
  * Attempt to pipe a value through a series of functions
395
+ *
376
396
  * @param initial Initial value
377
- * @returns Piped result
397
+ * @returns _Piped_ result
378
398
  */
379
399
  export function attemptPipe<
380
400
  Initial,
@@ -402,8 +422,9 @@ export function attemptPipe<
402
422
 
403
423
  /**
404
424
  * Attempt to pipe a value through a series of functions
425
+ *
405
426
  * @param initial Initial value
406
- * @returns Piped result
427
+ * @returns _Piped_ result
407
428
  */
408
429
  export function attemptPipe<
409
430
  Initial,
@@ -433,8 +454,9 @@ export function attemptPipe<
433
454
 
434
455
  /**
435
456
  * Attempt to pipe a result through a series of functions
457
+ *
436
458
  * @param initial Initial result
437
- * @returns Piped result
459
+ * @returns _Piped_ result
438
460
  */
439
461
  export function attemptPipe<Initial>(
440
462
  initial: GenericCallback | Initial | Result<Initial>,
package/src/sized/map.ts CHANGED
@@ -3,18 +3,18 @@ import {getSizedMaximum} from '../internal/sized';
3
3
  // #region Types and classes
4
4
 
5
5
  /**
6
- * A Map with a maximum size
6
+ * A _Map_ with a maximum size
7
7
  *
8
- * Behavior is similar to a _LRU_-cache, where the least recently used entries are removed
8
+ * Behavior is similar to a _LRU_ cache, where the least recently used entries are removed
9
9
  */
10
10
  export class SizedMap<SizedKey = unknown, SizedValue = unknown> extends Map<SizedKey, SizedValue> {
11
11
  /**
12
- * The maximum size of the Map
12
+ * The maximum size of the _Map_
13
13
  */
14
14
  readonly #maximumSize: number;
15
15
 
16
16
  /**
17
- * Is the Map full?
17
+ * Is the _Map_ full?
18
18
  */
19
19
  get full(): boolean {
20
20
  return super.size >= this.#maximumSize;
@@ -25,27 +25,30 @@ export class SizedMap<SizedKey = unknown, SizedValue = unknown> extends Map<Size
25
25
  }
26
26
 
27
27
  /**
28
- * Create a new SizedMap with entries and a maximum size _(2^20)_
29
- * @param entries Array of key-value pairs to initialize the SizedMap with
30
- * @template SizedKey Type of the keys in the SizedMap
31
- * @template SizedValue Type of the values in the SizedMap
28
+ * Create a new _SizedMap_ with entries and a maximum size _(2^20)_
29
+ *
30
+ * @param entries Array of key-value pairs to initialize the _SizedMap_ with
31
+ * @template SizedKey Type of the keys in the _SizedMap_
32
+ * @template SizedValue Type of the values in the _SizedMap_
32
33
  */
33
34
  constructor(entries: [SizedKey, SizedValue][]);
34
35
 
35
36
  /**
36
- * Create a new SizedMap with a maximum size _(but clamped at 2^24)_
37
- * @param maximum Maximum size of the SizedMap
38
- * @template SizedKey Type of the keys in the SizedMap
39
- * @template SizedValue Type of the values in the SizedMap
37
+ * Create a new _SizedMap_ with a maximum size _(but clamped at 2^24)_
38
+ *
39
+ * @param maximum Maximum size of the _SizedMap_
40
+ * @template SizedKey Type of the keys in the _SizedMap_
41
+ * @template SizedValue Type of the values in the _SizedMap_
40
42
  */
41
43
  constructor(maximum: number);
42
44
 
43
45
  /**
44
- * Create a new SizedMap with _(optional)_ entries and a maximum size _(defaults to 2^20; clamped at 2^24)_
45
- * @param entries Array of key-value pairs to initialize the SizedMap with
46
- * @param maximum Maximum size of the SizedMap
47
- * @template SizedKey Type of the keys in the SizedMap
48
- * @template SizedValue Type of the values in the SizedMap
46
+ * Create a new _SizedMap_ with _(optional)_ entries and a maximum size
47
+ *
48
+ * @param entries Array of key-value pairs to initialize the _SizedMap_ with
49
+ * @param maximum Maximum size of the _SizedMap_ _(defaults to 2^20; clamped at 2^24)_
50
+ * @template SizedKey Type of the keys in the _SizedMap_
51
+ * @template SizedValue Type of the values in the _SizedMap_
49
52
  */
50
53
  constructor(entries?: [SizedKey, SizedValue][], maximum?: number);
51
54
 
package/src/sized/set.ts CHANGED
@@ -3,18 +3,18 @@ import {getSizedMaximum} from '../internal/sized';
3
3
  // #region Types
4
4
 
5
5
  /**
6
- * A Set with a maximum size
6
+ * A _Set_ with a maximum size
7
7
  *
8
- * Behavior is similar to a _LRU_-cache, where the oldest values are removed
8
+ * Behavior is similar to a _LRU_ cache, where the oldest values are removed
9
9
  */
10
10
  export class SizedSet<Value = unknown> extends Set<Value> {
11
11
  /**
12
- * The maximum size of the Set
12
+ * The maximum size of the _Set_
13
13
  */
14
14
  readonly #maximumSize: number;
15
15
 
16
16
  /**
17
- * Is the Set full?
17
+ * Is the _Set_ full?
18
18
  */
19
19
  get full(): boolean {
20
20
  return this.size >= this.#maximumSize;
@@ -25,24 +25,27 @@ export class SizedSet<Value = unknown> extends Set<Value> {
25
25
  }
26
26
 
27
27
  /**
28
- * Create a new SizedSet with values and a maximum size _(2^20)_
29
- * @param values Array of values to initialize the SizedSet with
30
- * @template Value Type of the values in the SizedSet
28
+ * Create a new _SizedSet_ with values and a maximum size _(2^20)_
29
+ *
30
+ * @param values Array of values to initialize the _SizedSet_ with
31
+ * @template Value Type of the values in the _SizedSet_
31
32
  */
32
33
  constructor(values: Value[]);
33
34
 
34
35
  /**
35
- * Create a new SizedSet with a maximum size _(but clamped at 2^24)_
36
- * @param maximum Maximum size of the SizedSet
37
- * @template Value Type of the values in the SizedSet
36
+ * Create a new _SizedSet_ with a maximum size _(but clamped at 2^24)_
37
+ *
38
+ * @param maximum Maximum size of the _SizedSet_ _(defaults to 2^20; clamped at 2^24)_
39
+ * @template Value Type of the values in the _SizedSet_
38
40
  */
39
41
  constructor(maximum: number);
40
42
 
41
43
  /**
42
- * Create a new SizedSet with _(optional)_ values and a maximum size _(defaults to 2^20; clamped at 2^24)_
43
- * @param values Array of values to initialize the SizedSet with
44
- * @param maximum Maximum size of the SizedSet
45
- * @template Value Type of the values in the SizedSet
44
+ * Create a new _SizedSet_ with _(optional)_ values and a maximum size
45
+ *
46
+ * @param values Array of values to initialize the _SizedSet_ with
47
+ * @param maximum Maximum size of the _SizedSet_ _(defaults to 2^20; clamped at 2^24)_
48
+ * @template Value Type of the values in the _SizedSet_
46
49
  */
47
50
  constructor(values?: Value[], maximum?: number);
48
51
 
@@ -82,9 +85,10 @@ export class SizedSet<Value = unknown> extends Set<Value> {
82
85
  }
83
86
 
84
87
  /**
85
- * Get a value from the SizedSet, if it exists _(and move it to the end)_
86
- * @param value Value to get from the SizedSet
87
- * @param update Update the value's position in the SizedSet? _(defaults to `false`)_
88
+ * Get a value from the _SizedSet_, if it exists _(and optionally move it to the end)_
89
+ *
90
+ * @param value Value to get from the _SizedSet_
91
+ * @param update Update the value's position in the _SizedSet_? _(defaults to `false`)_
88
92
  * @returns Found value if it exists, otherwise `undefined`
89
93
  */
90
94
  get(value: Value, update?: boolean): Value | undefined {
@@ -17,6 +17,7 @@ type Options = {
17
17
 
18
18
  /**
19
19
  * Convert a string to camel case _(thisIsCamelCase)_
20
+ *
20
21
  * @param value String to convert
21
22
  * @returns Camel-cased string
22
23
  */
@@ -26,6 +27,7 @@ export function camelCase(value: string): string {
26
27
 
27
28
  /**
28
29
  * Capitalize the first letter of a string _(and lowercase the rest)_
30
+ *
29
31
  * @param value String to capitalize
30
32
  * @returns Capitalized string
31
33
  */
@@ -45,6 +47,7 @@ export function capitalize(value: string): string {
45
47
 
46
48
  /**
47
49
  * Convert a string to kebab case _(this-is-kebab-case)_
50
+ *
48
51
  * @param value String to convert
49
52
  * @returns Kebab-cased string
50
53
  */
@@ -54,6 +57,7 @@ export function kebabCase(value: string): string {
54
57
 
55
58
  /**
56
59
  * Convert a string to lower case
60
+ *
57
61
  * @param value String to convert
58
62
  * @returns Lower-cased string
59
63
  */
@@ -69,6 +73,7 @@ export function lowerCase(value: string): string {
69
73
 
70
74
  /**
71
75
  * Convert a string to pascal case _(ThisIsPascalCase)_
76
+ *
72
77
  * @param value String to convert
73
78
  * @returns Pascal-cased string
74
79
  */
@@ -78,6 +83,7 @@ export function pascalCase(value: string): string {
78
83
 
79
84
  /**
80
85
  * Convert a string to snake case _(this_is_snake_case)_
86
+ *
81
87
  * @param value String to convert
82
88
  * @returns Snake-cased string
83
89
  */
@@ -87,6 +93,7 @@ export function snakeCase(value: string): string {
87
93
 
88
94
  /**
89
95
  * Convert a string to title case _(Capitalizing Every Word)_
96
+ *
90
97
  * @param value String to convert
91
98
  * @returns Title-cased string
92
99
  */
@@ -169,6 +176,7 @@ function toCaseCallback(this: Options, value: string): string {
169
176
 
170
177
  /**
171
178
  * Convert a string to upper case
179
+ *
172
180
  * @param value String to convert
173
181
  * @returns Upper-cased string
174
182
  */
@@ -14,6 +14,8 @@ class Fuzzy<Item> {
14
14
 
15
15
  /**
16
16
  * Get items currently being searched through
17
+ *
18
+ * @returns Original items
17
19
  */
18
20
  get items(): Item[] {
19
21
  return this.#state.items.slice();
@@ -21,6 +23,8 @@ class Fuzzy<Item> {
21
23
 
22
24
  /**
23
25
  * Set new items to search through
26
+ *
27
+ * @param items New items to search through
24
28
  */
25
29
  set items(items: Item[]) {
26
30
  if (Array.isArray(items)) {
@@ -31,6 +35,8 @@ class Fuzzy<Item> {
31
35
 
32
36
  /**
33
37
  * Get strings currently being searched through _(the stringified version of `items`)_
38
+ *
39
+ * @returns Stringified items
34
40
  */
35
41
  get strings(): string[] {
36
42
  return this.#state.strings.slice();
@@ -42,6 +48,7 @@ class Fuzzy<Item> {
42
48
 
43
49
  /**
44
50
  * Search for items matching the given value
51
+ *
45
52
  * @param value Value to search for
46
53
  * @param options Search options
47
54
  * @returns Search results, with exact matches _(ordered)_ and similar matches _(ordered by relevance)_
@@ -50,6 +57,7 @@ class Fuzzy<Item> {
50
57
 
51
58
  /**
52
59
  * Search for items matching the given value
60
+ *
53
61
  * @param value Value to search for
54
62
  * @param limit Maximum number of combined items to return in `exact` and `similar`
55
63
  * @returns Search results, with exact matches _(ordered)_ and similar matches _(ordered by relevance)_
@@ -70,9 +78,8 @@ export type FuzzyConfiguration<Item> = {
70
78
  /**
71
79
  * Handler to stringify items
72
80
  *
73
- * May be a function that takes an item and returns a string, or if items are plain objects, a key of the item to use to grab a string value from
74
- *
75
- * Defaults to `getString`
81
+ * - May be a function that takes an item and returns a string, or if items are plain objects, a key of the item to use to grab a string value from
82
+ * - Defaults to `getString`
76
83
  */
77
84
  handler?: (item: Item) => string;
78
85
  } & (Item extends PlainObject
@@ -80,7 +87,7 @@ export type FuzzyConfiguration<Item> = {
80
87
  /**
81
88
  * Key to use to stringify items
82
89
  *
83
- * Prioritized over `handler`
90
+ * _Prioritized over `handler`_
84
91
  */
85
92
  key?: keyof Item;
86
93
  }
@@ -98,7 +105,10 @@ export type FuzzyOptions = {
98
105
  */
99
106
  limit?: number;
100
107
  /**
101
- * Maximum score difference between the best and worst similar matches included in results; higher values cast a wider net _(defaults to 5)_
108
+ * Maximum score difference between the best and worst similar matches included in results
109
+ *
110
+ * - Higher values cast a wider net
111
+ * - Defaults to `5`
102
112
  */
103
113
  tolerance?: number;
104
114
  };
@@ -207,6 +217,7 @@ function getTolerance<Item>(input: unknown, state?: FuzzyState<Item>): number {
207
217
 
208
218
  /**
209
219
  * Create a fuzzy searcher for an array of items
220
+ *
210
221
  * @param items Items to search through
211
222
  * @param key Key to use to stringify items
212
223
  * @returns Fuzzy searcher
@@ -218,6 +229,7 @@ export function fuzzy<Item extends PlainObject, ItemKey extends keyof Item>(
218
229
 
219
230
  /**
220
231
  * Create a fuzzy searcher for an array of items
232
+ *
221
233
  * @param items Items to search through
222
234
  * @param handler Handler to stringify items
223
235
  * @returns Fuzzy searcher
@@ -226,6 +238,7 @@ export function fuzzy<Item>(items: Item[], handler?: (item: Item) => string): Fu
226
238
 
227
239
  /**
228
240
  * Create a fuzzy searcher for an array of items
241
+ *
229
242
  * @param items Items to search through
230
243
  * @param configuration Fuzzy configuration
231
244
  * @returns Fuzzy searcher
@@ -244,6 +257,7 @@ fuzzy.match = fuzzyMatch;
244
257
 
245
258
  /**
246
259
  * Does the needle match the haystack in a fuzzy way?
260
+ *
247
261
  * @param haystack Haystack to search through
248
262
  * @param needle Needle to search for
249
263
  * @returns `true` if the needle matches the haystack in a fuzzy way, `false` otherwise
@@ -1,10 +1,21 @@
1
1
  import {isTemplateStringsArray} from '../internal/is';
2
- import {getString} from '../internal/string';
2
+ import {interpolate} from '../internal/string';
3
3
 
4
4
  // #region Functions
5
5
 
6
+ /**
7
+ * Dedent a string template, removing common leading whitespace from each line
8
+ *
9
+ * @returns Dedented string
10
+ */
6
11
  export function dedent(strings: TemplateStringsArray, ...values: unknown[]): string;
7
12
 
13
+ /**
14
+ * Dedent a string, removing common leading whitespace from each line
15
+ *
16
+ * @param value String to dedent
17
+ * @returns Dedented string
18
+ */
8
19
  export function dedent(value: string): string;
9
20
 
10
21
  export function dedent(value: string | TemplateStringsArray, ...values: unknown[]): string {
@@ -59,7 +70,8 @@ export function dedent(value: string | TemplateStringsArray, ...values: unknown[
59
70
  }
60
71
 
61
72
  /**
62
- * Get a new UUID-string _(version 4)_
73
+ * Get a new UUID string _(version 4)_
74
+ *
63
75
  * @returns UUID string
64
76
  */
65
77
  export function getUuid(): string {
@@ -82,20 +94,9 @@ export function getUuid(): string {
82
94
  ].join('-');
83
95
  }
84
96
 
85
- function interpolate(strings: TemplateStringsArray, values: unknown[]): string {
86
- const {length} = strings;
87
-
88
- let interpolated = '';
89
-
90
- for (let index = 0; index < length; index += 1) {
91
- interpolated += `${strings[index]}${getString(values[index])}`;
92
- }
93
-
94
- return interpolated;
95
- }
96
-
97
97
  /**
98
98
  * Parse a JSON string into its proper value _(or `undefined` if it fails)_
99
+ *
99
100
  * @param value JSON string to parse
100
101
  * @param reviver Reviver function to transform the parsed values
101
102
  * @returns Parsed value or `undefined` if parsing fails
@@ -113,6 +114,7 @@ export function parse(
113
114
 
114
115
  /**
115
116
  * Trim a string _(removing whitespace from both ends)_
117
+ *
116
118
  * @param value String to trim
117
119
  * @returns Trimmed string
118
120
  */
@@ -121,7 +123,8 @@ export function trim(value: string): string {
121
123
  }
122
124
 
123
125
  /**
124
- * Truncate a string to a specified length, when possible
126
+ * Truncate a string to a specified length
127
+ *
125
128
  * @param value String to truncate
126
129
  * @param length Maximum length of the string after truncation
127
130
  * @param suffix Suffix to append to the truncated string
@@ -10,6 +10,7 @@ type Match = 'endsWith' | 'includes' | 'startsWith';
10
10
 
11
11
  /**
12
12
  * Check if a string ends with a specified substring
13
+ *
13
14
  * @param haystack String to look in
14
15
  * @param needle String to look for
15
16
  * @param ignoreCase Ignore case when matching? _(defaults to `false`)_
@@ -21,6 +22,7 @@ export function endsWith(haystack: string, needle: string, ignoreCase?: boolean)
21
22
 
22
23
  /**
23
24
  * Check if a string includes a specified substring
25
+ *
24
26
  * @param haystack String to look in
25
27
  * @param needle String to look for
26
28
  * @param ignoreCase Ignore case when matching? _(defaults to `false`)_
@@ -53,6 +55,7 @@ function matchCallback(
53
55
 
54
56
  /**
55
57
  * Check if a string starts with a specified substring
58
+ *
56
59
  * @param haystack String to look in
57
60
  * @param needle String to look for
58
61
  * @param ignoreCase Ignore case when matching? _(defaults to `false`)_