@oscarpalmer/atoms 0.193.0 → 0.193.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/package.json +3 -4
  2. package/src/array/difference.ts +0 -73
  3. package/src/array/exists.ts +0 -93
  4. package/src/array/filter.ts +0 -182
  5. package/src/array/find.ts +0 -183
  6. package/src/array/first.ts +0 -196
  7. package/src/array/flatten.ts +0 -20
  8. package/src/array/from.ts +0 -129
  9. package/src/array/get.ts +0 -131
  10. package/src/array/group-by.ts +0 -369
  11. package/src/array/index.ts +0 -26
  12. package/src/array/insert.ts +0 -52
  13. package/src/array/intersection.ts +0 -72
  14. package/src/array/last.ts +0 -194
  15. package/src/array/match.ts +0 -436
  16. package/src/array/move.ts +0 -315
  17. package/src/array/partition.ts +0 -91
  18. package/src/array/push.ts +0 -23
  19. package/src/array/reverse.ts +0 -33
  20. package/src/array/select.ts +0 -260
  21. package/src/array/single.ts +0 -93
  22. package/src/array/slice.ts +0 -335
  23. package/src/array/sort.ts +0 -607
  24. package/src/array/splice.ts +0 -106
  25. package/src/array/swap.ts +0 -322
  26. package/src/array/to-map.ts +0 -371
  27. package/src/array/to-record.ts +0 -351
  28. package/src/array/to-set.ts +0 -80
  29. package/src/array/toggle.ts +0 -79
  30. package/src/array/union.ts +0 -72
  31. package/src/array/unique.ts +0 -67
  32. package/src/array/update.ts +0 -75
  33. package/src/beacon.ts +0 -378
  34. package/src/color/constants.ts +0 -137
  35. package/src/color/index.ts +0 -83
  36. package/src/color/instance.ts +0 -162
  37. package/src/color/misc/alpha.ts +0 -56
  38. package/src/color/misc/format.ts +0 -29
  39. package/src/color/misc/get.ts +0 -210
  40. package/src/color/misc/is.ts +0 -221
  41. package/src/color/misc/state.ts +0 -243
  42. package/src/color/models.ts +0 -389
  43. package/src/color/space/hex.ts +0 -184
  44. package/src/color/space/hsl.ts +0 -174
  45. package/src/color/space/hwb.ts +0 -153
  46. package/src/color/space/rgb.ts +0 -240
  47. package/src/function/assert.ts +0 -174
  48. package/src/function/index.ts +0 -2
  49. package/src/function/limit.ts +0 -83
  50. package/src/function/memoize.ts +0 -202
  51. package/src/function/once.ts +0 -200
  52. package/src/function/retry.ts +0 -175
  53. package/src/function/work.ts +0 -1007
  54. package/src/herald.ts +0 -216
  55. package/src/index.ts +0 -68
  56. package/src/internal/array/callbacks.ts +0 -46
  57. package/src/internal/array/chunk.ts +0 -51
  58. package/src/internal/array/compact.ts +0 -56
  59. package/src/internal/array/find.ts +0 -200
  60. package/src/internal/array/group.ts +0 -42
  61. package/src/internal/array/index-of.ts +0 -182
  62. package/src/internal/array/insert.ts +0 -80
  63. package/src/internal/array/overlap.ts +0 -35
  64. package/src/internal/array/sets.ts +0 -74
  65. package/src/internal/array/shuffle.ts +0 -33
  66. package/src/internal/array/update.ts +0 -52
  67. package/src/internal/function/misc.ts +0 -8
  68. package/src/internal/function/timer.ts +0 -168
  69. package/src/internal/is.ts +0 -244
  70. package/src/internal/math/aggregate.ts +0 -164
  71. package/src/internal/math/misc.ts +0 -28
  72. package/src/internal/number.ts +0 -129
  73. package/src/internal/random.ts +0 -49
  74. package/src/internal/result.ts +0 -92
  75. package/src/internal/sized.ts +0 -25
  76. package/src/internal/string.ts +0 -128
  77. package/src/internal/subscription.ts +0 -264
  78. package/src/internal/value/compare.ts +0 -170
  79. package/src/internal/value/equal.ts +0 -465
  80. package/src/internal/value/get.ts +0 -57
  81. package/src/internal/value/handlers.ts +0 -95
  82. package/src/internal/value/has.ts +0 -118
  83. package/src/internal/value/misc.ts +0 -125
  84. package/src/internal/value/partial.ts +0 -46
  85. package/src/internal/value/set.ts +0 -132
  86. package/src/is.ts +0 -182
  87. package/src/logger.ts +0 -230
  88. package/src/math.ts +0 -281
  89. package/src/models.ts +0 -286
  90. package/src/number.ts +0 -1
  91. package/src/promise/delay.ts +0 -62
  92. package/src/promise/helpers.ts +0 -96
  93. package/src/promise/index.ts +0 -300
  94. package/src/promise/misc.ts +0 -96
  95. package/src/promise/models.ts +0 -195
  96. package/src/promise/timed.ts +0 -91
  97. package/src/query.ts +0 -147
  98. package/src/queue.ts +0 -814
  99. package/src/random.ts +0 -125
  100. package/src/result/index.ts +0 -105
  101. package/src/result/match.ts +0 -124
  102. package/src/result/misc.ts +0 -129
  103. package/src/result/models.ts +0 -83
  104. package/src/result/work/flow.ts +0 -488
  105. package/src/result/work/pipe.ts +0 -496
  106. package/src/sized/map.ts +0 -110
  107. package/src/sized/set.ts +0 -107
  108. package/src/string/case.ts +0 -236
  109. package/src/string/fuzzy.ts +0 -444
  110. package/src/string/index.ts +0 -199
  111. package/src/string/match.ts +0 -80
  112. package/src/string/normalize.ts +0 -205
  113. package/src/string/template.ts +0 -161
  114. package/src/value/clone.ts +0 -319
  115. package/src/value/collection.ts +0 -63
  116. package/src/value/diff.ts +0 -232
  117. package/src/value/freeze.ts +0 -322
  118. package/src/value/handle.ts +0 -3
  119. package/src/value/index.ts +0 -5
  120. package/src/value/merge.ts +0 -278
  121. package/src/value/omit.ts +0 -20
  122. package/src/value/pick.ts +0 -20
  123. package/src/value/shake.ts +0 -45
  124. package/src/value/smush.ts +0 -89
  125. package/src/value/transform.ts +0 -153
  126. package/src/value/unsmush.ts +0 -84
@@ -1,488 +0,0 @@
1
- import {flow} from '../../function/work';
2
- import {isError, isOk} from '../../internal/result';
3
- import type {GenericCallback} from '../../models';
4
- import {attempt} from '../index';
5
- import type {Result, UnwrapValue} from '../models';
6
-
7
- // #region Types
8
-
9
- /**
10
- * A synchronous _Flow_, a function that attempts to pipe values through a series of functions
11
- */
12
- export type AttemptFlow<Callback extends GenericCallback, Value> = (
13
- ...args: Parameters<Callback>
14
- ) => Result<UnwrapValue<Value>>;
15
-
16
- /**
17
- * An asynchronous _Flow_, a function that attempts to pipe values through a series of functions
18
- */
19
- export type AttemptFlowPromise<Callback extends GenericCallback, Value> = (
20
- ...args: Parameters<Callback>
21
- ) => Promise<Result<UnwrapValue<Value>>>;
22
-
23
- // #endregion
24
-
25
- // #region Functions
26
-
27
- // #region Asynchronous
28
-
29
- /**
30
- * Create an asynchronous _Flow_, a function that attempts to pipe a value through a series of functions
31
- *
32
- * _Available as `attemptAsyncFlow` and `attemptFlow.async`_
33
- *
34
- * @returns _Flow_ function
35
- */
36
- export function attemptAsyncFlow<Fn extends GenericCallback>(
37
- fn: Fn,
38
- ): AttemptFlowPromise<Fn, ReturnType<Fn>>;
39
-
40
- /**
41
- * Create an asynchronous _Flow_, a function that pipes values through a series of functions
42
- *
43
- * _Available as `attemptAsyncFlow` and `attemptFlow.async`_
44
- *
45
- * @returns _Flow_ function
46
- */
47
- export function attemptAsyncFlow<First extends GenericCallback, Second>(
48
- first: First,
49
- second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
50
- ): AttemptFlowPromise<First, Second>;
51
-
52
- /**
53
- * Create an asynchronous _Flow_, a function that pipes values through a series of functions
54
- *
55
- * _Available as `attemptAsyncFlow` and `attemptFlow.async`_
56
- *
57
- * @returns _Flow_ function
58
- */
59
- export function attemptAsyncFlow<First extends GenericCallback, Second, Third>(
60
- first: First,
61
- second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
62
- third: (value: Awaited<UnwrapValue<Second>>) => Third,
63
- ): AttemptFlowPromise<First, Third>;
64
-
65
- /**
66
- * Create an asynchronous _Flow_, a function that pipes values through a series of functions
67
- *
68
- * _Available as `attemptAsyncFlow` and `attemptFlow.async`_
69
- *
70
- * @returns _Flow_ function
71
- */
72
- export function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth>(
73
- first: First,
74
- second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
75
- third: (value: Awaited<UnwrapValue<Second>>) => Third,
76
- fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth,
77
- ): AttemptFlowPromise<First, Fourth>;
78
-
79
- /**
80
- * Create an asynchronous _Flow_, a function that pipes values through a series of functions
81
- *
82
- * _Available as `attemptAsyncFlow` and `attemptFlow.async`_
83
- *
84
- * @returns _Flow_ function
85
- */
86
- export function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(
87
- first: First,
88
- second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
89
- third: (value: Awaited<UnwrapValue<Second>>) => Third,
90
- fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth,
91
- fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth,
92
- ): AttemptFlowPromise<First, Fifth>;
93
-
94
- /**
95
- * Create an asynchronous _Flow_, a function that pipes values through a series of functions
96
- *
97
- * _Available as `attemptAsyncFlow` and `attemptFlow.async`_
98
- *
99
- * @returns _Flow_ function
100
- */
101
- export function attemptAsyncFlow<
102
- First extends GenericCallback,
103
- Second,
104
- Third,
105
- Fourth,
106
- Fifth,
107
- Sixth,
108
- >(
109
- first: First,
110
- second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
111
- third: (value: Awaited<UnwrapValue<Second>>) => Third,
112
- fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth,
113
- fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth,
114
- sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth,
115
- ): AttemptFlowPromise<First, Sixth>;
116
-
117
- /**
118
- * Create an asynchronous _Flow_, a function that pipes values through a series of functions
119
- *
120
- * _Available as `attemptAsyncFlow` and `attemptFlow.async`_
121
- *
122
- * @returns _Flow_ function
123
- */
124
- export function attemptAsyncFlow<
125
- First extends GenericCallback,
126
- Second,
127
- Third,
128
- Fourth,
129
- Fifth,
130
- Sixth,
131
- Seventh,
132
- >(
133
- first: First,
134
- second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
135
- third: (value: Awaited<UnwrapValue<Second>>) => Third,
136
- fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth,
137
- fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth,
138
- sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth,
139
- seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh,
140
- ): AttemptFlowPromise<First, Seventh>;
141
-
142
- /**
143
- * Create an asynchronous _Flow_, a function that pipes values through a series of functions
144
- *
145
- * _Available as `attemptAsyncFlow` and `attemptFlow.async`_
146
- *
147
- * @returns _Flow_ function
148
- */
149
- export function attemptAsyncFlow<
150
- First extends GenericCallback,
151
- Second,
152
- Third,
153
- Fourth,
154
- Fifth,
155
- Sixth,
156
- Seventh,
157
- Eighth,
158
- >(
159
- first: First,
160
- second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
161
- third: (value: Awaited<UnwrapValue<Second>>) => Third,
162
- fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth,
163
- fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth,
164
- sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth,
165
- seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh,
166
- eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth,
167
- ): AttemptFlowPromise<First, Eighth>;
168
-
169
- /**
170
- * Create an asynchronous _Flow_, a function that pipes values through a series of functions
171
- *
172
- * _Available as `attemptAsyncFlow` and `attemptFlow.async`_
173
- *
174
- * @returns _Flow_ function
175
- */
176
- export function attemptAsyncFlow<
177
- First extends GenericCallback,
178
- Second,
179
- Third,
180
- Fourth,
181
- Fifth,
182
- Sixth,
183
- Seventh,
184
- Eighth,
185
- Ninth,
186
- >(
187
- first: First,
188
- second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
189
- third: (value: Awaited<UnwrapValue<Second>>) => Third,
190
- fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth,
191
- fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth,
192
- sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth,
193
- seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh,
194
- eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth,
195
- ninth: (value: Awaited<UnwrapValue<Eighth>>) => Ninth,
196
- ): AttemptFlowPromise<First, Ninth>;
197
-
198
- /**
199
- * Create an asynchronous _Flow_, a function that pipes values through a series of functions
200
- *
201
- * _Available as `attemptAsyncFlow` and `attemptFlow.async`_
202
- *
203
- * @returns _Flow_ function
204
- */
205
- export function attemptAsyncFlow<
206
- First extends GenericCallback,
207
- Second,
208
- Third,
209
- Fourth,
210
- Fifth,
211
- Sixth,
212
- Seventh,
213
- Eighth,
214
- Ninth,
215
- Tenth,
216
- >(
217
- first: First,
218
- second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
219
- third: (value: Awaited<UnwrapValue<Second>>) => Third,
220
- fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth,
221
- fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth,
222
- sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth,
223
- seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh,
224
- eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth,
225
- ninth: (value: Awaited<UnwrapValue<Eighth>>) => Ninth,
226
- tenth: (value: Awaited<UnwrapValue<Ninth>>) => Tenth,
227
- ): AttemptFlowPromise<First, Tenth>;
228
-
229
- /**
230
- * Create an asynchronous _Flow_, a function that pipes values through a series of functions
231
- *
232
- * _Available as `attemptAsyncFlow` and `attemptFlow.async`_
233
- *
234
- * @returns _Flow_ function
235
- */
236
- export function attemptAsyncFlow<Fn extends GenericCallback>(
237
- fn: Fn,
238
- ...fns: Array<(value: Awaited<UnwrapValue<ReturnType<Fn>>>) => unknown>
239
- ): AttemptFlowPromise<Fn, ReturnType<Fn>>;
240
-
241
- /**
242
- * Create an asynchronous _Flow_, a function that pipes values through a series of functions
243
- *
244
- * _Available as `attemptAsyncFlow` and `attemptFlow.async`_
245
- *
246
- * @returns _Flow_ function
247
- */
248
- export function attemptAsyncFlow(
249
- ...fns: GenericCallback[]
250
- ): (...args: unknown[]) => Promise<Result<unknown>>;
251
-
252
- export function attemptAsyncFlow(
253
- ...fns: GenericCallback[]
254
- ): (...args: unknown[]) => Promise<Result<unknown>> {
255
- let Flow: GenericCallback;
256
-
257
- return (...args: unknown[]) =>
258
- attempt.async(() => {
259
- Flow ??= flow.async(...fns);
260
-
261
- return Flow(
262
- ...args.map(value => {
263
- if (isError(value)) {
264
- throw value.error;
265
- }
266
-
267
- return isOk(value) ? value.value : value;
268
- }),
269
- );
270
- });
271
- }
272
-
273
- // #endregion
274
-
275
- // #region Synchronous
276
-
277
- /**
278
- * Create a _Flow_, a function that attempts to pipe values through a function
279
- *
280
- * @returns _Flow_ function
281
- */
282
- export function attemptFlow<Fn extends GenericCallback>(fn: Fn): AttemptFlow<Fn, ReturnType<Fn>>;
283
-
284
- /**
285
- * Create a _Flow_, a function that attempts to pipe values through a series of functions
286
- *
287
- * @returns _Flow_ function
288
- */
289
- export function attemptFlow<First extends GenericCallback, Second>(
290
- first: First,
291
- second: (value: UnwrapValue<ReturnType<First>>) => Second,
292
- ): AttemptFlow<First, Second>;
293
-
294
- /**
295
- * Create a _Flow_, a function that attempts to pipe values through a series of functions
296
- *
297
- * @returns _Flow_ function
298
- */
299
- export function attemptFlow<First extends GenericCallback, Second, Third>(
300
- first: First,
301
- second: (value: UnwrapValue<ReturnType<First>>) => Second,
302
- third: (value: UnwrapValue<Second>) => Third,
303
- ): AttemptFlow<First, Third>;
304
-
305
- /**
306
- * Create a _Flow_, a function that attempts to pipe values through a series of functions
307
- *
308
- * @returns _Flow_ function
309
- */
310
- export function attemptFlow<First extends GenericCallback, Second, Third, Fourth>(
311
- first: First,
312
- second: (value: UnwrapValue<ReturnType<First>>) => Second,
313
- third: (value: UnwrapValue<Second>) => Third,
314
- fourth: (value: UnwrapValue<Third>) => Fourth,
315
- ): AttemptFlow<First, Fourth>;
316
-
317
- /**
318
- * Create a _Flow_, a function that attempts to pipe values through a series of functions
319
- *
320
- * @returns _Flow_ function
321
- */
322
- export function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(
323
- first: First,
324
- second: (value: UnwrapValue<ReturnType<First>>) => Second,
325
- third: (value: UnwrapValue<Second>) => Third,
326
- fourth: (value: UnwrapValue<Third>) => Fourth,
327
- fifth: (value: UnwrapValue<Fourth>) => Fifth,
328
- ): AttemptFlow<First, Fifth>;
329
-
330
- /**
331
- * Create a _Flow_, a function that attempts to pipe values through a series of functions
332
- *
333
- * @returns _Flow_ function
334
- */
335
- export function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth>(
336
- first: First,
337
- second: (value: UnwrapValue<ReturnType<First>>) => Second,
338
- third: (value: UnwrapValue<Second>) => Third,
339
- fourth: (value: UnwrapValue<Third>) => Fourth,
340
- fifth: (value: UnwrapValue<Fourth>) => Fifth,
341
- sixth: (value: UnwrapValue<Fifth>) => Sixth,
342
- ): AttemptFlow<First, Sixth>;
343
-
344
- /**
345
- * Create a _Flow_, a function that attempts to pipe values through a series of functions
346
- *
347
- * @returns _Flow_ function
348
- */
349
- export function attemptFlow<
350
- First extends GenericCallback,
351
- Second,
352
- Third,
353
- Fourth,
354
- Fifth,
355
- Sixth,
356
- Seventh,
357
- >(
358
- first: First,
359
- second: (value: UnwrapValue<ReturnType<First>>) => Second,
360
- third: (value: UnwrapValue<Second>) => Third,
361
- fourth: (value: UnwrapValue<Third>) => Fourth,
362
- fifth: (value: UnwrapValue<Fourth>) => Fifth,
363
- sixth: (value: UnwrapValue<Fifth>) => Sixth,
364
- seventh: (value: UnwrapValue<Sixth>) => Seventh,
365
- ): AttemptFlow<First, Seventh>;
366
-
367
- /**
368
- * Create a _Flow_, a function that attempts to pipe values through a series of functions
369
- *
370
- * @returns _Flow_ function
371
- */
372
- export function attemptFlow<
373
- First extends GenericCallback,
374
- Second,
375
- Third,
376
- Fourth,
377
- Fifth,
378
- Sixth,
379
- Seventh,
380
- Eighth,
381
- >(
382
- first: First,
383
- second: (value: UnwrapValue<ReturnType<First>>) => Second,
384
- third: (value: UnwrapValue<Second>) => Third,
385
- fourth: (value: UnwrapValue<Third>) => Fourth,
386
- fifth: (value: UnwrapValue<Fourth>) => Fifth,
387
- sixth: (value: UnwrapValue<Fifth>) => Sixth,
388
- seventh: (value: UnwrapValue<Sixth>) => Seventh,
389
- eighth: (value: UnwrapValue<Seventh>) => Eighth,
390
- ): AttemptFlow<First, Eighth>;
391
-
392
- /**
393
- * Create a _Flow_, a function that attempts to pipe values through a series of functions
394
- *
395
- * @returns _Flow_ function
396
- */
397
- export function attemptFlow<
398
- First extends GenericCallback,
399
- Second,
400
- Third,
401
- Fourth,
402
- Fifth,
403
- Sixth,
404
- Seventh,
405
- Eighth,
406
- Ninth,
407
- >(
408
- first: First,
409
- second: (value: UnwrapValue<ReturnType<First>>) => Second,
410
- third: (value: UnwrapValue<Second>) => Third,
411
- fourth: (value: UnwrapValue<Third>) => Fourth,
412
- fifth: (value: UnwrapValue<Fourth>) => Fifth,
413
- sixth: (value: UnwrapValue<Fifth>) => Sixth,
414
- seventh: (value: UnwrapValue<Sixth>) => Seventh,
415
- eighth: (value: UnwrapValue<Seventh>) => Eighth,
416
- ninth: (value: UnwrapValue<Eighth>) => Ninth,
417
- ): AttemptFlow<First, Ninth>;
418
-
419
- /**
420
- * Create a _Flow_, a function that attempts to pipe values through a series of functions
421
- *
422
- * @returns _Flow_ function
423
- */
424
- export function attemptFlow<
425
- First extends GenericCallback,
426
- Second,
427
- Third,
428
- Fourth,
429
- Fifth,
430
- Sixth,
431
- Seventh,
432
- Eighth,
433
- Ninth,
434
- Tenth,
435
- >(
436
- first: First,
437
- second: (value: UnwrapValue<ReturnType<First>>) => Second,
438
- third: (value: UnwrapValue<Second>) => Third,
439
- fourth: (value: UnwrapValue<Third>) => Fourth,
440
- fifth: (value: UnwrapValue<Fourth>) => Fifth,
441
- sixth: (value: UnwrapValue<Fifth>) => Sixth,
442
- seventh: (value: UnwrapValue<Sixth>) => Seventh,
443
- eighth: (value: UnwrapValue<Seventh>) => Eighth,
444
- ninth: (value: UnwrapValue<Eighth>) => Ninth,
445
- tenth: (value: UnwrapValue<Ninth>) => Tenth,
446
- ): AttemptFlow<First, Tenth>;
447
-
448
- /**
449
- * Create a _Flow_, a function that attempts to pipe values through a series of functions
450
- *
451
- * @returns _Flow_ function
452
- */
453
- export function attemptFlow<First extends GenericCallback>(
454
- first: First,
455
- ...fns: Array<(value: UnwrapValue<ReturnType<First>>) => unknown>
456
- ): AttemptFlow<First, ReturnType<First>>;
457
-
458
- /**
459
- * Create a _Flow_, a function that attempts to pipe values through a series of functions
460
- *
461
- * @returns _Flow_ function
462
- */
463
- export function attemptFlow(...fns: GenericCallback[]): (...args: unknown[]) => Result<unknown>;
464
-
465
- export function attemptFlow(...fns: GenericCallback[]): (...args: unknown[]) => Result<unknown> {
466
- let Flow: GenericCallback;
467
-
468
- return (...args: unknown[]) =>
469
- attempt(() => {
470
- Flow ??= flow(...fns);
471
-
472
- return Flow(
473
- ...args.map(value => {
474
- if (isError(value)) {
475
- throw value.error;
476
- }
477
-
478
- return isOk(value) ? value.value : value;
479
- }),
480
- );
481
- });
482
- }
483
-
484
- attemptFlow.async = attemptAsyncFlow;
485
-
486
- // #endregion
487
-
488
- // #endregion