@oscarpalmer/atoms 0.179.0 → 0.180.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 (100) hide show
  1. package/dist/array/filter.d.mts +36 -28
  2. package/dist/array/filter.mjs +5 -5
  3. package/dist/array/first.d.mts +13 -5
  4. package/dist/array/first.mjs +1 -1
  5. package/dist/array/group-by.d.mts +13 -1
  6. package/dist/array/group-by.mjs +1 -1
  7. package/dist/array/last.d.mts +9 -1
  8. package/dist/array/last.mjs +1 -1
  9. package/dist/array/move.d.mts +9 -1
  10. package/dist/array/move.mjs +3 -1
  11. package/dist/array/reverse.d.mts +5 -0
  12. package/dist/array/reverse.mjs +5 -0
  13. package/dist/array/select.d.mts +2 -2
  14. package/dist/array/sort.d.mts +23 -9
  15. package/dist/array/sort.mjs +22 -22
  16. package/dist/array/swap.d.mts +2 -0
  17. package/dist/array/swap.mjs +2 -0
  18. package/dist/array/to-map.d.mts +13 -1
  19. package/dist/array/to-map.mjs +1 -1
  20. package/dist/array/to-record.d.mts +13 -1
  21. package/dist/array/to-record.mjs +1 -1
  22. package/dist/function/assert.d.mts +9 -1
  23. package/dist/function/assert.mjs +9 -1
  24. package/dist/function/limit.d.mts +5 -1
  25. package/dist/function/limit.mjs +5 -1
  26. package/dist/function/once.d.mts +3 -1
  27. package/dist/function/once.mjs +3 -1
  28. package/dist/function/retry.d.mts +4 -0
  29. package/dist/function/retry.mjs +2 -0
  30. package/dist/function/work.d.mts +49 -1
  31. package/dist/function/work.mjs +1 -1
  32. package/dist/index.d.mts +415 -242
  33. package/dist/index.mjs +224 -167
  34. package/dist/internal/array/index-of.mjs +1 -1
  35. package/dist/internal/function/timer.mjs +3 -1
  36. package/dist/internal/value/compare.d.mts +13 -9
  37. package/dist/internal/value/compare.mjs +13 -9
  38. package/dist/internal/value/equal.d.mts +29 -15
  39. package/dist/internal/value/equal.mjs +41 -35
  40. package/dist/internal/value/handlers.d.mts +4 -4
  41. package/dist/internal/value/handlers.mjs +19 -11
  42. package/dist/internal/value/has.d.mts +9 -8
  43. package/dist/internal/value/has.mjs +3 -3
  44. package/dist/internal/value/misc.d.mts +4 -8
  45. package/dist/internal/value/misc.mjs +6 -17
  46. package/dist/promise/index.d.mts +11 -1
  47. package/dist/promise/index.mjs +1 -1
  48. package/dist/result/index.d.mts +9 -1
  49. package/dist/result/index.mjs +1 -1
  50. package/dist/result/match.d.mts +5 -1
  51. package/dist/result/match.mjs +1 -1
  52. package/dist/result/misc.d.mts +3 -3
  53. package/dist/result/work/flow.d.mts +49 -1
  54. package/dist/result/work/flow.mjs +1 -1
  55. package/dist/result/work/pipe.d.mts +67 -155
  56. package/dist/result/work/pipe.mjs +3 -3
  57. package/dist/string/fuzzy.d.mts +11 -1
  58. package/dist/string/fuzzy.mjs +22 -6
  59. package/dist/string/template.d.mts +3 -1
  60. package/dist/string/template.mjs +3 -1
  61. package/dist/value/clone.d.mts +13 -9
  62. package/dist/value/clone.mjs +21 -17
  63. package/dist/value/merge.d.mts +9 -7
  64. package/dist/value/merge.mjs +7 -5
  65. package/package.json +3 -3
  66. package/plugin/helpers.js +2 -2
  67. package/src/array/filter.ts +44 -36
  68. package/src/array/first.ts +18 -9
  69. package/src/array/group-by.ts +22 -10
  70. package/src/array/last.ts +17 -5
  71. package/src/array/move.ts +18 -5
  72. package/src/array/reverse.ts +5 -0
  73. package/src/array/select.ts +2 -2
  74. package/src/array/sort.ts +110 -86
  75. package/src/array/swap.ts +2 -0
  76. package/src/array/to-map.ts +22 -10
  77. package/src/array/to-record.ts +22 -10
  78. package/src/function/assert.ts +12 -4
  79. package/src/function/limit.ts +6 -2
  80. package/src/function/once.ts +3 -1
  81. package/src/function/retry.ts +8 -2
  82. package/src/function/work.ts +92 -26
  83. package/src/internal/array/index-of.ts +1 -1
  84. package/src/internal/function/timer.ts +4 -2
  85. package/src/internal/string.ts +2 -0
  86. package/src/internal/value/compare.ts +14 -11
  87. package/src/internal/value/equal.ts +79 -67
  88. package/src/internal/value/handlers.ts +19 -11
  89. package/src/internal/value/has.ts +16 -16
  90. package/src/internal/value/misc.ts +10 -8
  91. package/src/promise/index.ts +14 -4
  92. package/src/result/index.ts +15 -5
  93. package/src/result/match.ts +7 -3
  94. package/src/result/misc.ts +3 -3
  95. package/src/result/work/flow.ts +68 -13
  96. package/src/result/work/pipe.ts +97 -392
  97. package/src/string/fuzzy.ts +34 -8
  98. package/src/string/template.ts +3 -1
  99. package/src/value/clone.ts +25 -22
  100. package/src/value/merge.ts +14 -12
@@ -28,26 +28,32 @@ export type AttemptFlowPromise<Callback extends GenericCallback, Value> = (
28
28
 
29
29
  /**
30
30
  * Create an asynchronous Flow, a function that attempts to pipe a value through a series of functions
31
+ *
32
+ * Available as `attemptAsyncFlow` and `attempt.flow.async`
31
33
  * @returns Flow function
32
34
  */
33
- function attemptAsyncFlow<Fn extends GenericCallback>(
35
+ export function attemptAsyncFlow<Fn extends GenericCallback>(
34
36
  fn: Fn,
35
37
  ): AttemptFlowPromise<Fn, ReturnType<Fn>>;
36
38
 
37
39
  /**
38
40
  * Create an asynchronous Flow, a function that pipes values through a series of functions
41
+ *
42
+ * Available as `attemptAsyncFlow` and `attempt.flow.async`
39
43
  * @returns Flow function
40
44
  */
41
- function attemptAsyncFlow<First extends GenericCallback, Second>(
45
+ export function attemptAsyncFlow<First extends GenericCallback, Second>(
42
46
  first: First,
43
47
  second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
44
48
  ): AttemptFlowPromise<First, Second>;
45
49
 
46
50
  /**
47
51
  * Create an asynchronous Flow, a function that pipes values through a series of functions
52
+ *
53
+ * Available as `attemptAsyncFlow` and `attempt.flow.async`
48
54
  * @returns Flow function
49
55
  */
50
- function attemptAsyncFlow<First extends GenericCallback, Second, Third>(
56
+ export function attemptAsyncFlow<First extends GenericCallback, Second, Third>(
51
57
  first: First,
52
58
  second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
53
59
  third: (value: Awaited<UnwrapValue<Second>>) => Third,
@@ -55,9 +61,11 @@ function attemptAsyncFlow<First extends GenericCallback, Second, Third>(
55
61
 
56
62
  /**
57
63
  * Create an asynchronous Flow, a function that pipes values through a series of functions
64
+ *
65
+ * Available as `attemptAsyncFlow` and `attempt.flow.async`
58
66
  * @returns Flow function
59
67
  */
60
- function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth>(
68
+ export function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth>(
61
69
  first: First,
62
70
  second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
63
71
  third: (value: Awaited<UnwrapValue<Second>>) => Third,
@@ -66,9 +74,11 @@ function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth>(
66
74
 
67
75
  /**
68
76
  * Create an asynchronous Flow, a function that pipes values through a series of functions
77
+ *
78
+ * Available as `attemptAsyncFlow` and `attempt.flow.async`
69
79
  * @returns Flow function
70
80
  */
71
- function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(
81
+ export function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(
72
82
  first: First,
73
83
  second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
74
84
  third: (value: Awaited<UnwrapValue<Second>>) => Third,
@@ -78,9 +88,18 @@ function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth,
78
88
 
79
89
  /**
80
90
  * Create an asynchronous Flow, a function that pipes values through a series of functions
91
+ *
92
+ * Available as `attemptAsyncFlow` and `attempt.flow.async`
81
93
  * @returns Flow function
82
94
  */
83
- function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth>(
95
+ export function attemptAsyncFlow<
96
+ First extends GenericCallback,
97
+ Second,
98
+ Third,
99
+ Fourth,
100
+ Fifth,
101
+ Sixth,
102
+ >(
84
103
  first: First,
85
104
  second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
86
105
  third: (value: Awaited<UnwrapValue<Second>>) => Third,
@@ -91,9 +110,11 @@ function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth,
91
110
 
92
111
  /**
93
112
  * Create an asynchronous Flow, a function that pipes values through a series of functions
113
+ *
114
+ * Available as `attemptAsyncFlow` and `attempt.flow.async`
94
115
  * @returns Flow function
95
116
  */
96
- function attemptAsyncFlow<
117
+ export function attemptAsyncFlow<
97
118
  First extends GenericCallback,
98
119
  Second,
99
120
  Third,
@@ -113,9 +134,11 @@ function attemptAsyncFlow<
113
134
 
114
135
  /**
115
136
  * Create an asynchronous Flow, a function that pipes values through a series of functions
137
+ *
138
+ * Available as `attemptAsyncFlow` and `attempt.flow.async`
116
139
  * @returns Flow function
117
140
  */
118
- function attemptAsyncFlow<
141
+ export function attemptAsyncFlow<
119
142
  First extends GenericCallback,
120
143
  Second,
121
144
  Third,
@@ -137,9 +160,11 @@ function attemptAsyncFlow<
137
160
 
138
161
  /**
139
162
  * Create an asynchronous Flow, a function that pipes values through a series of functions
163
+ *
164
+ * Available as `attemptAsyncFlow` and `attempt.flow.async`
140
165
  * @returns Flow function
141
166
  */
142
- function attemptAsyncFlow<
167
+ export function attemptAsyncFlow<
143
168
  First extends GenericCallback,
144
169
  Second,
145
170
  Third,
@@ -163,9 +188,11 @@ function attemptAsyncFlow<
163
188
 
164
189
  /**
165
190
  * Create an asynchronous Flow, a function that pipes values through a series of functions
191
+ *
192
+ * Available as `attemptAsyncFlow` and `attempt.flow.async`
166
193
  * @returns Flow function
167
194
  */
168
- function attemptAsyncFlow<
195
+ export function attemptAsyncFlow<
169
196
  First extends GenericCallback,
170
197
  Second,
171
198
  Third,
@@ -191,22 +218,26 @@ function attemptAsyncFlow<
191
218
 
192
219
  /**
193
220
  * Create an asynchronous Flow, a function that pipes values through a series of functions
221
+ *
222
+ * Available as `attemptAsyncFlow` and `attempt.flow.async`
194
223
  * @returns Flow function
195
224
  */
196
- function attemptAsyncFlow<Fn extends GenericCallback>(
225
+ export function attemptAsyncFlow<Fn extends GenericCallback>(
197
226
  fn: Fn,
198
227
  ...fns: Array<(value: Awaited<UnwrapValue<ReturnType<Fn>>>) => unknown>
199
228
  ): AttemptFlowPromise<Fn, ReturnType<Fn>>;
200
229
 
201
230
  /**
202
231
  * Create an asynchronous Flow, a function that pipes values through a series of functions
232
+ *
233
+ * Available as `attemptAsyncFlow` and `attempt.flow.async`
203
234
  * @returns Flow function
204
235
  */
205
- function attemptAsyncFlow(
236
+ export function attemptAsyncFlow(
206
237
  ...fns: GenericCallback[]
207
238
  ): (...args: unknown[]) => Promise<Result<unknown>>;
208
239
 
209
- function attemptAsyncFlow(
240
+ export function attemptAsyncFlow(
210
241
  ...fns: GenericCallback[]
211
242
  ): (...args: unknown[]) => Promise<Result<unknown>> {
212
243
  let Flow: GenericCallback;
@@ -233,12 +264,16 @@ function attemptAsyncFlow(
233
264
 
234
265
  /**
235
266
  * Create a Flow, a function that attempts to pipe values through a function
267
+ *
268
+ * Available as `attemptFlow` and `attempt.flow`
236
269
  * @returns Flow function
237
270
  */
238
271
  export function attemptFlow<Fn extends GenericCallback>(fn: Fn): AttemptFlow<Fn, ReturnType<Fn>>;
239
272
 
240
273
  /**
241
274
  * Create a Flow, a function that attempts to pipe values through a series of functions
275
+ *
276
+ * Available as `attemptFlow` and `attempt.flow`
242
277
  * @returns Flow function
243
278
  */
244
279
  export function attemptFlow<First extends GenericCallback, Second>(
@@ -248,6 +283,8 @@ export function attemptFlow<First extends GenericCallback, Second>(
248
283
 
249
284
  /**
250
285
  * Create a Flow, a function that attempts to pipe values through a series of functions
286
+ *
287
+ * Available as `attemptFlow` and `attempt.flow`
251
288
  * @returns Flow function
252
289
  */
253
290
  export function attemptFlow<First extends GenericCallback, Second, Third>(
@@ -258,6 +295,8 @@ export function attemptFlow<First extends GenericCallback, Second, Third>(
258
295
 
259
296
  /**
260
297
  * Create a Flow, a function that attempts to pipe values through a series of functions
298
+ *
299
+ * Available as `attemptFlow` and `attempt.flow`
261
300
  * @returns Flow function
262
301
  */
263
302
  export function attemptFlow<First extends GenericCallback, Second, Third, Fourth>(
@@ -269,6 +308,8 @@ export function attemptFlow<First extends GenericCallback, Second, Third, Fourth
269
308
 
270
309
  /**
271
310
  * Create a Flow, a function that attempts to pipe values through a series of functions
311
+ *
312
+ * Available as `attemptFlow` and `attempt.flow`
272
313
  * @returns Flow function
273
314
  */
274
315
  export function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(
@@ -281,6 +322,8 @@ export function attemptFlow<First extends GenericCallback, Second, Third, Fourth
281
322
 
282
323
  /**
283
324
  * Create a Flow, a function that attempts to pipe values through a series of functions
325
+ *
326
+ * Available as `attemptFlow` and `attempt.flow`
284
327
  * @returns Flow function
285
328
  */
286
329
  export function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth>(
@@ -294,6 +337,8 @@ export function attemptFlow<First extends GenericCallback, Second, Third, Fourth
294
337
 
295
338
  /**
296
339
  * Create a Flow, a function that attempts to pipe values through a series of functions
340
+ *
341
+ * Available as `attemptFlow` and `attempt.flow`
297
342
  * @returns Flow function
298
343
  */
299
344
  export function attemptFlow<
@@ -316,6 +361,8 @@ export function attemptFlow<
316
361
 
317
362
  /**
318
363
  * Create a Flow, a function that attempts to pipe values through a series of functions
364
+ *
365
+ * Available as `attemptFlow` and `attempt.flow`
319
366
  * @returns Flow function
320
367
  */
321
368
  export function attemptFlow<
@@ -340,6 +387,8 @@ export function attemptFlow<
340
387
 
341
388
  /**
342
389
  * Create a Flow, a function that attempts to pipe values through a series of functions
390
+ *
391
+ * Available as `attemptFlow` and `attempt.flow`
343
392
  * @returns Flow function
344
393
  */
345
394
  export function attemptFlow<
@@ -366,6 +415,8 @@ export function attemptFlow<
366
415
 
367
416
  /**
368
417
  * Create a Flow, a function that attempts to pipe values through a series of functions
418
+ *
419
+ * Available as `attemptFlow` and `attempt.flow`
369
420
  * @returns Flow function
370
421
  */
371
422
  export function attemptFlow<
@@ -394,6 +445,8 @@ export function attemptFlow<
394
445
 
395
446
  /**
396
447
  * Create a Flow, a function that attempts to pipe values through a series of functions
448
+ *
449
+ * Available as `attemptFlow` and `attempt.flow`
397
450
  * @returns Flow function
398
451
  */
399
452
  export function attemptFlow<First extends GenericCallback>(
@@ -403,6 +456,8 @@ export function attemptFlow<First extends GenericCallback>(
403
456
 
404
457
  /**
405
458
  * Create a Flow, a function that attempts to pipe values through a series of functions
459
+ *
460
+ * Available as `attemptFlow` and `attempt.flow`
406
461
  * @returns Flow function
407
462
  */
408
463
  export function attemptFlow(...fns: GenericCallback[]): (...args: unknown[]) => Result<unknown>;