@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.
- package/dist/array/filter.d.mts +36 -28
- package/dist/array/filter.mjs +5 -5
- package/dist/array/first.d.mts +13 -5
- package/dist/array/first.mjs +1 -1
- package/dist/array/group-by.d.mts +13 -1
- package/dist/array/group-by.mjs +1 -1
- package/dist/array/last.d.mts +9 -1
- package/dist/array/last.mjs +1 -1
- package/dist/array/move.d.mts +9 -1
- package/dist/array/move.mjs +3 -1
- package/dist/array/reverse.d.mts +5 -0
- package/dist/array/reverse.mjs +5 -0
- package/dist/array/select.d.mts +2 -2
- package/dist/array/sort.d.mts +23 -9
- package/dist/array/sort.mjs +22 -22
- package/dist/array/swap.d.mts +2 -0
- package/dist/array/swap.mjs +2 -0
- package/dist/array/to-map.d.mts +13 -1
- package/dist/array/to-map.mjs +1 -1
- package/dist/array/to-record.d.mts +13 -1
- package/dist/array/to-record.mjs +1 -1
- package/dist/function/assert.d.mts +9 -1
- package/dist/function/assert.mjs +9 -1
- package/dist/function/limit.d.mts +5 -1
- package/dist/function/limit.mjs +5 -1
- package/dist/function/once.d.mts +3 -1
- package/dist/function/once.mjs +3 -1
- package/dist/function/retry.d.mts +4 -0
- package/dist/function/retry.mjs +2 -0
- package/dist/function/work.d.mts +49 -1
- package/dist/function/work.mjs +1 -1
- package/dist/index.d.mts +415 -242
- package/dist/index.mjs +224 -167
- package/dist/internal/array/index-of.mjs +1 -1
- package/dist/internal/function/timer.mjs +3 -1
- package/dist/internal/value/compare.d.mts +13 -9
- package/dist/internal/value/compare.mjs +13 -9
- package/dist/internal/value/equal.d.mts +29 -15
- package/dist/internal/value/equal.mjs +41 -35
- package/dist/internal/value/handlers.d.mts +4 -4
- package/dist/internal/value/handlers.mjs +19 -11
- package/dist/internal/value/has.d.mts +9 -8
- package/dist/internal/value/has.mjs +3 -3
- package/dist/internal/value/misc.d.mts +4 -8
- package/dist/internal/value/misc.mjs +6 -17
- package/dist/promise/index.d.mts +11 -1
- package/dist/promise/index.mjs +1 -1
- package/dist/result/index.d.mts +9 -1
- package/dist/result/index.mjs +1 -1
- package/dist/result/match.d.mts +5 -1
- package/dist/result/match.mjs +1 -1
- package/dist/result/misc.d.mts +3 -3
- package/dist/result/work/flow.d.mts +49 -1
- package/dist/result/work/flow.mjs +1 -1
- package/dist/result/work/pipe.d.mts +67 -155
- package/dist/result/work/pipe.mjs +3 -3
- package/dist/string/fuzzy.d.mts +11 -1
- package/dist/string/fuzzy.mjs +22 -6
- package/dist/string/template.d.mts +3 -1
- package/dist/string/template.mjs +3 -1
- package/dist/value/clone.d.mts +13 -9
- package/dist/value/clone.mjs +21 -17
- package/dist/value/merge.d.mts +9 -7
- package/dist/value/merge.mjs +7 -5
- package/package.json +3 -3
- package/plugin/helpers.js +2 -2
- package/src/array/filter.ts +44 -36
- package/src/array/first.ts +18 -9
- package/src/array/group-by.ts +22 -10
- package/src/array/last.ts +17 -5
- package/src/array/move.ts +18 -5
- package/src/array/reverse.ts +5 -0
- package/src/array/select.ts +2 -2
- package/src/array/sort.ts +110 -86
- package/src/array/swap.ts +2 -0
- package/src/array/to-map.ts +22 -10
- package/src/array/to-record.ts +22 -10
- package/src/function/assert.ts +12 -4
- package/src/function/limit.ts +6 -2
- package/src/function/once.ts +3 -1
- package/src/function/retry.ts +8 -2
- package/src/function/work.ts +92 -26
- package/src/internal/array/index-of.ts +1 -1
- package/src/internal/function/timer.ts +4 -2
- package/src/internal/string.ts +2 -0
- package/src/internal/value/compare.ts +14 -11
- package/src/internal/value/equal.ts +79 -67
- package/src/internal/value/handlers.ts +19 -11
- package/src/internal/value/has.ts +16 -16
- package/src/internal/value/misc.ts +10 -8
- package/src/promise/index.ts +14 -4
- package/src/result/index.ts +15 -5
- package/src/result/match.ts +7 -3
- package/src/result/misc.ts +3 -3
- package/src/result/work/flow.ts +68 -13
- package/src/result/work/pipe.ts +97 -392
- package/src/string/fuzzy.ts +34 -8
- package/src/string/template.ts +3 -1
- package/src/value/clone.ts +25 -22
- package/src/value/merge.ts +14 -12
package/src/result/work/pipe.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {pipe} from '../../function/work';
|
|
1
|
+
import {asyncPipe, pipe} from '../../function/work';
|
|
2
2
|
import {isError, isOk} from '../../internal/result';
|
|
3
3
|
import type {GenericCallback} from '../../models';
|
|
4
4
|
import {attempt} from '../index';
|
|
@@ -15,45 +15,53 @@ type WrapValue<Value> = Result<UnwrapValue<Value>>;
|
|
|
15
15
|
// #region Asynchronous
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Attempt to pipe a
|
|
19
|
-
*
|
|
18
|
+
* Attempt to pipe a value through a function
|
|
19
|
+
*
|
|
20
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
21
|
+
* @param initial Initial value
|
|
20
22
|
* @returns Piped result
|
|
21
23
|
*/
|
|
22
|
-
function attemptAsyncPipe<Initial, Piped>(
|
|
23
|
-
initial: Result<Initial>,
|
|
24
|
+
export async function attemptAsyncPipe<Initial, Piped>(
|
|
25
|
+
initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
|
|
24
26
|
pipe: (value: UnwrapValue<Initial>) => Piped,
|
|
25
27
|
): Promise<WrapValue<Piped>>;
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
|
-
* Attempt to pipe a
|
|
29
|
-
*
|
|
30
|
+
* Attempt to pipe a value through a series of functions
|
|
31
|
+
*
|
|
32
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
33
|
+
* @param initial Initial value
|
|
30
34
|
* @returns Piped result
|
|
31
35
|
*/
|
|
32
|
-
function attemptAsyncPipe<Initial, First, Second>(
|
|
33
|
-
initial: Result<Initial>,
|
|
36
|
+
export async function attemptAsyncPipe<Initial, First, Second>(
|
|
37
|
+
initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
|
|
34
38
|
first: (value: UnwrapValue<Initial>) => First,
|
|
35
39
|
second: (value: UnwrapValue<First>) => Second,
|
|
36
40
|
): Promise<WrapValue<Second>>;
|
|
37
41
|
|
|
38
42
|
/**
|
|
39
|
-
* Attempt to pipe a
|
|
40
|
-
*
|
|
43
|
+
* Attempt to pipe a value through a series of functions
|
|
44
|
+
*
|
|
45
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
46
|
+
* @param initial Initial value
|
|
41
47
|
* @returns Piped result
|
|
42
48
|
*/
|
|
43
|
-
function attemptAsyncPipe<Initial, First, Second, Third>(
|
|
44
|
-
initial: Result<Initial>,
|
|
49
|
+
export async function attemptAsyncPipe<Initial, First, Second, Third>(
|
|
50
|
+
initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
|
|
45
51
|
first: (value: UnwrapValue<Initial>) => First,
|
|
46
52
|
second: (value: UnwrapValue<First>) => Second,
|
|
47
53
|
third: (value: UnwrapValue<Second>) => Third,
|
|
48
54
|
): Promise<WrapValue<Third>>;
|
|
49
55
|
|
|
50
56
|
/**
|
|
51
|
-
* Attempt to pipe a
|
|
52
|
-
*
|
|
57
|
+
* Attempt to pipe a value through a series of functions
|
|
58
|
+
*
|
|
59
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
60
|
+
* @param initial Initial value
|
|
53
61
|
* @returns Piped result
|
|
54
62
|
*/
|
|
55
|
-
function attemptAsyncPipe<Initial, First, Second, Third, Fourth>(
|
|
56
|
-
initial: Result<Initial>,
|
|
63
|
+
export async function attemptAsyncPipe<Initial, First, Second, Third, Fourth>(
|
|
64
|
+
initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
|
|
57
65
|
first: (value: UnwrapValue<Initial>) => First,
|
|
58
66
|
second: (value: UnwrapValue<First>) => Second,
|
|
59
67
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -61,12 +69,14 @@ function attemptAsyncPipe<Initial, First, Second, Third, Fourth>(
|
|
|
61
69
|
): Promise<WrapValue<Fourth>>;
|
|
62
70
|
|
|
63
71
|
/**
|
|
64
|
-
* Attempt to pipe a
|
|
65
|
-
*
|
|
72
|
+
* Attempt to pipe a value through a series of functions
|
|
73
|
+
*
|
|
74
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
75
|
+
* @param initial Initial value
|
|
66
76
|
* @returns Piped result
|
|
67
77
|
*/
|
|
68
|
-
function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth>(
|
|
69
|
-
initial: Result<Initial>,
|
|
78
|
+
export async function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth>(
|
|
79
|
+
initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
|
|
70
80
|
first: (value: UnwrapValue<Initial>) => First,
|
|
71
81
|
second: (value: UnwrapValue<First>) => Second,
|
|
72
82
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -75,12 +85,14 @@ function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth>(
|
|
|
75
85
|
): Promise<WrapValue<Fifth>>;
|
|
76
86
|
|
|
77
87
|
/**
|
|
78
|
-
* Attempt to pipe a
|
|
79
|
-
*
|
|
88
|
+
* Attempt to pipe a value through a series of functions
|
|
89
|
+
*
|
|
90
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
91
|
+
* @param initial Initial value
|
|
80
92
|
* @returns Piped result
|
|
81
93
|
*/
|
|
82
|
-
function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(
|
|
83
|
-
initial: Result<Initial>,
|
|
94
|
+
export async function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(
|
|
95
|
+
initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
|
|
84
96
|
first: (value: UnwrapValue<Initial>) => First,
|
|
85
97
|
second: (value: UnwrapValue<First>) => Second,
|
|
86
98
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -90,44 +102,13 @@ function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(
|
|
|
90
102
|
): Promise<WrapValue<Sixth>>;
|
|
91
103
|
|
|
92
104
|
/**
|
|
93
|
-
* Attempt to pipe a
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
|
|
97
|
-
function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(
|
|
98
|
-
initial: Result<Initial>,
|
|
99
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
100
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
101
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
102
|
-
fourth: (value: UnwrapValue<Third>) => Fourth,
|
|
103
|
-
fifth: (value: UnwrapValue<Fourth>) => Fifth,
|
|
104
|
-
sixth: (value: UnwrapValue<Fifth>) => Sixth,
|
|
105
|
-
seventh: (value: UnwrapValue<Sixth>) => Seventh,
|
|
106
|
-
): Promise<WrapValue<Seventh>>;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Attempt to pipe a result through a series of functions
|
|
110
|
-
* @param initial Initial result
|
|
111
|
-
* @returns Piped result
|
|
112
|
-
*/
|
|
113
|
-
function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(
|
|
114
|
-
initial: Result<Initial>,
|
|
115
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
116
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
117
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
118
|
-
fourth: (value: UnwrapValue<Third>) => Fourth,
|
|
119
|
-
fifth: (value: UnwrapValue<Fourth>) => Fifth,
|
|
120
|
-
sixth: (value: UnwrapValue<Fifth>) => Sixth,
|
|
121
|
-
seventh: (value: UnwrapValue<Sixth>) => Seventh,
|
|
122
|
-
eighth: (value: UnwrapValue<Seventh>) => Eighth,
|
|
123
|
-
): Promise<WrapValue<Eighth>>;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Attempt to pipe a result through a series of functions
|
|
127
|
-
* @param initial Initial result
|
|
105
|
+
* Attempt to pipe a value through a series of functions
|
|
106
|
+
*
|
|
107
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
108
|
+
* @param initial Initial value
|
|
128
109
|
* @returns Piped result
|
|
129
110
|
*/
|
|
130
|
-
function attemptAsyncPipe<
|
|
111
|
+
export async function attemptAsyncPipe<
|
|
131
112
|
Initial,
|
|
132
113
|
First,
|
|
133
114
|
Second,
|
|
@@ -136,10 +117,8 @@ function attemptAsyncPipe<
|
|
|
136
117
|
Fifth,
|
|
137
118
|
Sixth,
|
|
138
119
|
Seventh,
|
|
139
|
-
Eighth,
|
|
140
|
-
Ninth,
|
|
141
120
|
>(
|
|
142
|
-
initial: Result<Initial>,
|
|
121
|
+
initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
|
|
143
122
|
first: (value: UnwrapValue<Initial>) => First,
|
|
144
123
|
second: (value: UnwrapValue<First>) => Second,
|
|
145
124
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -147,16 +126,16 @@ function attemptAsyncPipe<
|
|
|
147
126
|
fifth: (value: UnwrapValue<Fourth>) => Fifth,
|
|
148
127
|
sixth: (value: UnwrapValue<Fifth>) => Sixth,
|
|
149
128
|
seventh: (value: UnwrapValue<Sixth>) => Seventh,
|
|
150
|
-
|
|
151
|
-
ninth: (value: UnwrapValue<Eighth>) => Ninth,
|
|
152
|
-
): Promise<WrapValue<Ninth>>;
|
|
129
|
+
): Promise<WrapValue<Seventh>>;
|
|
153
130
|
|
|
154
131
|
/**
|
|
155
|
-
* Attempt to pipe a
|
|
156
|
-
*
|
|
132
|
+
* Attempt to pipe a value through a series of functions
|
|
133
|
+
*
|
|
134
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
135
|
+
* @param initial Initial value
|
|
157
136
|
* @returns Piped result
|
|
158
137
|
*/
|
|
159
|
-
function attemptAsyncPipe<
|
|
138
|
+
export async function attemptAsyncPipe<
|
|
160
139
|
Initial,
|
|
161
140
|
First,
|
|
162
141
|
Second,
|
|
@@ -166,120 +145,8 @@ function attemptAsyncPipe<
|
|
|
166
145
|
Sixth,
|
|
167
146
|
Seventh,
|
|
168
147
|
Eighth,
|
|
169
|
-
Ninth,
|
|
170
|
-
Tenth,
|
|
171
148
|
>(
|
|
172
|
-
initial: Result<Initial>,
|
|
173
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
174
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
175
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
176
|
-
fourth: (value: UnwrapValue<Third>) => Fourth,
|
|
177
|
-
fifth: (value: UnwrapValue<Fourth>) => Fifth,
|
|
178
|
-
sixth: (value: UnwrapValue<Fifth>) => Sixth,
|
|
179
|
-
seventh: (value: UnwrapValue<Sixth>) => Seventh,
|
|
180
|
-
eighth: (value: UnwrapValue<Seventh>) => Eighth,
|
|
181
|
-
ninth: (value: UnwrapValue<Eighth>) => Ninth,
|
|
182
|
-
tenth: (value: UnwrapValue<Ninth>) => Tenth,
|
|
183
|
-
): Promise<WrapValue<Tenth>>;
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Attempt to pipe a value through a function
|
|
187
|
-
* @param initial Initial value
|
|
188
|
-
* @returns Piped result
|
|
189
|
-
*/
|
|
190
|
-
function attemptAsyncPipe<Initial, Piped>(
|
|
191
|
-
initial: GenericCallback | Initial,
|
|
192
|
-
pipe: (value: UnwrapValue<Initial>) => Piped,
|
|
193
|
-
): Promise<WrapValue<Piped>>;
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Attempt to pipe a value through a series of functions
|
|
197
|
-
* @param initial Initial value
|
|
198
|
-
* @returns Piped result
|
|
199
|
-
*/
|
|
200
|
-
function attemptAsyncPipe<Initial, First, Second>(
|
|
201
|
-
initial: GenericCallback | Initial,
|
|
202
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
203
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
204
|
-
): Promise<WrapValue<Second>>;
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Attempt to pipe a value through a series of functions
|
|
208
|
-
* @param initial Initial value
|
|
209
|
-
* @returns Piped result
|
|
210
|
-
*/
|
|
211
|
-
function attemptAsyncPipe<Initial, First, Second, Third>(
|
|
212
|
-
initial: GenericCallback | Initial,
|
|
213
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
214
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
215
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
216
|
-
): Promise<WrapValue<Third>>;
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Attempt to pipe a value through a series of functions
|
|
220
|
-
* @param initial Initial value
|
|
221
|
-
* @returns Piped result
|
|
222
|
-
*/
|
|
223
|
-
function attemptAsyncPipe<Initial, First, Second, Third, Fourth>(
|
|
224
|
-
initial: GenericCallback | Initial,
|
|
225
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
226
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
227
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
228
|
-
fourth: (value: UnwrapValue<Third>) => Fourth,
|
|
229
|
-
): Promise<WrapValue<Fourth>>;
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Attempt to pipe a value through a series of functions
|
|
233
|
-
* @param initial Initial value
|
|
234
|
-
* @returns Piped result
|
|
235
|
-
*/
|
|
236
|
-
function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth>(
|
|
237
|
-
initial: GenericCallback | Initial,
|
|
238
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
239
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
240
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
241
|
-
fourth: (value: UnwrapValue<Third>) => Fourth,
|
|
242
|
-
fifth: (value: UnwrapValue<Fourth>) => Fifth,
|
|
243
|
-
): Promise<WrapValue<Fifth>>;
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Attempt to pipe a value through a series of functions
|
|
247
|
-
* @param initial Initial value
|
|
248
|
-
* @returns Piped result
|
|
249
|
-
*/
|
|
250
|
-
function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(
|
|
251
|
-
initial: GenericCallback | Initial,
|
|
252
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
253
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
254
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
255
|
-
fourth: (value: UnwrapValue<Third>) => Fourth,
|
|
256
|
-
fifth: (value: UnwrapValue<Fourth>) => Fifth,
|
|
257
|
-
sixth: (value: UnwrapValue<Fifth>) => Sixth,
|
|
258
|
-
): Promise<WrapValue<Sixth>>;
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Attempt to pipe a value through a series of functions
|
|
262
|
-
* @param initial Initial value
|
|
263
|
-
* @returns Piped result
|
|
264
|
-
*/
|
|
265
|
-
function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(
|
|
266
|
-
initial: GenericCallback | Initial,
|
|
267
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
268
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
269
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
270
|
-
fourth: (value: UnwrapValue<Third>) => Fourth,
|
|
271
|
-
fifth: (value: UnwrapValue<Fourth>) => Fifth,
|
|
272
|
-
sixth: (value: UnwrapValue<Fifth>) => Sixth,
|
|
273
|
-
seventh: (value: UnwrapValue<Sixth>) => Seventh,
|
|
274
|
-
): Promise<WrapValue<Seventh>>;
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Attempt to pipe a value through a series of functions
|
|
278
|
-
* @param initial Initial value
|
|
279
|
-
* @returns Piped result
|
|
280
|
-
*/
|
|
281
|
-
function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(
|
|
282
|
-
initial: GenericCallback | Initial,
|
|
149
|
+
initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
|
|
283
150
|
first: (value: UnwrapValue<Initial>) => First,
|
|
284
151
|
second: (value: UnwrapValue<First>) => Second,
|
|
285
152
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -292,10 +159,12 @@ function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, S
|
|
|
292
159
|
|
|
293
160
|
/**
|
|
294
161
|
* Attempt to pipe a value through a series of functions
|
|
162
|
+
*
|
|
163
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
295
164
|
* @param initial Initial value
|
|
296
165
|
* @returns Piped result
|
|
297
166
|
*/
|
|
298
|
-
function attemptAsyncPipe<
|
|
167
|
+
export async function attemptAsyncPipe<
|
|
299
168
|
Initial,
|
|
300
169
|
First,
|
|
301
170
|
Second,
|
|
@@ -307,7 +176,7 @@ function attemptAsyncPipe<
|
|
|
307
176
|
Eighth,
|
|
308
177
|
Ninth,
|
|
309
178
|
>(
|
|
310
|
-
initial: GenericCallback | Initial
|
|
179
|
+
initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
|
|
311
180
|
first: (value: UnwrapValue<Initial>) => First,
|
|
312
181
|
second: (value: UnwrapValue<First>) => Second,
|
|
313
182
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -321,10 +190,12 @@ function attemptAsyncPipe<
|
|
|
321
190
|
|
|
322
191
|
/**
|
|
323
192
|
* Attempt to pipe a value through a series of functions
|
|
193
|
+
*
|
|
194
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
324
195
|
* @param initial Initial value
|
|
325
196
|
* @returns Piped result
|
|
326
197
|
*/
|
|
327
|
-
function attemptAsyncPipe<
|
|
198
|
+
export async function attemptAsyncPipe<
|
|
328
199
|
Initial,
|
|
329
200
|
First,
|
|
330
201
|
Second,
|
|
@@ -337,7 +208,7 @@ function attemptAsyncPipe<
|
|
|
337
208
|
Ninth,
|
|
338
209
|
Tenth,
|
|
339
210
|
>(
|
|
340
|
-
initial: GenericCallback | Initial
|
|
211
|
+
initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
|
|
341
212
|
first: (value: UnwrapValue<Initial>) => First,
|
|
342
213
|
second: (value: UnwrapValue<First>) => Second,
|
|
343
214
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -352,27 +223,18 @@ function attemptAsyncPipe<
|
|
|
352
223
|
|
|
353
224
|
/**
|
|
354
225
|
* Attempt to pipe a result through a series of functions
|
|
226
|
+
*
|
|
227
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
355
228
|
* @param initial Initial result
|
|
356
229
|
* @returns Piped result
|
|
357
230
|
*/
|
|
358
|
-
function attemptAsyncPipe<Initial>(
|
|
359
|
-
initial: Result<Initial>,
|
|
360
|
-
first?: (value: UnwrapValue<Initial>) => unknown,
|
|
361
|
-
...seconds: Array<(value: unknown) => unknown>
|
|
362
|
-
): Promise<WrapValue<Initial>>;
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Attempt to pipe an item through a series of functions
|
|
366
|
-
* @param item Initial value
|
|
367
|
-
* @returns Piped result
|
|
368
|
-
*/
|
|
369
|
-
function attemptAsyncPipe<Initial>(
|
|
370
|
-
initial: GenericCallback | Initial,
|
|
231
|
+
export async function attemptAsyncPipe<Initial>(
|
|
232
|
+
initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>,
|
|
371
233
|
first?: (value: UnwrapValue<Initial>) => unknown,
|
|
372
234
|
...seconds: Array<(value: unknown) => unknown>
|
|
373
235
|
): Promise<WrapValue<Initial>>;
|
|
374
236
|
|
|
375
|
-
async function attemptAsyncPipe(
|
|
237
|
+
export async function attemptAsyncPipe(
|
|
376
238
|
initial: unknown,
|
|
377
239
|
first?: (value: unknown) => unknown,
|
|
378
240
|
...seconds: Array<(value: unknown) => unknown>
|
|
@@ -393,7 +255,7 @@ async function attemptAsyncPipe(
|
|
|
393
255
|
return value;
|
|
394
256
|
}
|
|
395
257
|
|
|
396
|
-
return
|
|
258
|
+
return asyncPipe(value, ...([first, ...seconds] as GenericCallback[]));
|
|
397
259
|
});
|
|
398
260
|
}
|
|
399
261
|
|
|
@@ -401,202 +263,40 @@ async function attemptAsyncPipe(
|
|
|
401
263
|
|
|
402
264
|
// #region Synchronous
|
|
403
265
|
|
|
404
|
-
/**
|
|
405
|
-
* Attempt to pipe a result through a function
|
|
406
|
-
* @param initial Initial result
|
|
407
|
-
* @returns Piped result
|
|
408
|
-
*/
|
|
409
|
-
export function attemptPipe<Initial, Piped>(
|
|
410
|
-
initial: Result<Initial>,
|
|
411
|
-
pipe: (value: UnwrapValue<Initial>) => Piped,
|
|
412
|
-
): WrapValue<Piped>;
|
|
413
|
-
|
|
414
|
-
/**
|
|
415
|
-
* Attempt to pipe a result through a series of functions
|
|
416
|
-
* @param initial Initial result
|
|
417
|
-
* @returns Piped result
|
|
418
|
-
*/
|
|
419
|
-
export function attemptPipe<Initial, First, Second>(
|
|
420
|
-
initial: Result<Initial>,
|
|
421
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
422
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
423
|
-
): WrapValue<Second>;
|
|
424
|
-
|
|
425
|
-
/**
|
|
426
|
-
* Attempt to pipe a result through a series of functions
|
|
427
|
-
* @param initial Initial result
|
|
428
|
-
* @returns Piped result
|
|
429
|
-
*/
|
|
430
|
-
export function attemptPipe<Initial, First, Second, Third>(
|
|
431
|
-
initial: Result<Initial>,
|
|
432
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
433
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
434
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
435
|
-
): WrapValue<Third>;
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* Attempt to pipe a result through a series of functions
|
|
439
|
-
* @param initial Initial result
|
|
440
|
-
* @returns Piped result
|
|
441
|
-
*/
|
|
442
|
-
export function attemptPipe<Initial, First, Second, Third, Fourth>(
|
|
443
|
-
initial: Result<Initial>,
|
|
444
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
445
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
446
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
447
|
-
fourth: (value: UnwrapValue<Third>) => Fourth,
|
|
448
|
-
): WrapValue<Fourth>;
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
* Attempt to pipe a result through a series of functions
|
|
452
|
-
* @param initial Initial result
|
|
453
|
-
* @returns Piped result
|
|
454
|
-
*/
|
|
455
|
-
export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth>(
|
|
456
|
-
initial: Result<Initial>,
|
|
457
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
458
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
459
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
460
|
-
fourth: (value: UnwrapValue<Third>) => Fourth,
|
|
461
|
-
fifth: (value: UnwrapValue<Fourth>) => Fifth,
|
|
462
|
-
): WrapValue<Fifth>;
|
|
463
|
-
|
|
464
|
-
/**
|
|
465
|
-
* Attempt to pipe a result through a series of functions
|
|
466
|
-
* @param initial Initial result
|
|
467
|
-
* @returns Piped result
|
|
468
|
-
*/
|
|
469
|
-
export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(
|
|
470
|
-
initial: Result<Initial>,
|
|
471
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
472
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
473
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
474
|
-
fourth: (value: UnwrapValue<Third>) => Fourth,
|
|
475
|
-
fifth: (value: UnwrapValue<Fourth>) => Fifth,
|
|
476
|
-
sixth: (value: UnwrapValue<Fifth>) => Sixth,
|
|
477
|
-
): WrapValue<Sixth>;
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Attempt to pipe a result through a series of functions
|
|
481
|
-
* @param initial Initial result
|
|
482
|
-
* @returns Piped result
|
|
483
|
-
*/
|
|
484
|
-
export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(
|
|
485
|
-
initial: Result<Initial>,
|
|
486
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
487
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
488
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
489
|
-
fourth: (value: UnwrapValue<Third>) => Fourth,
|
|
490
|
-
fifth: (value: UnwrapValue<Fourth>) => Fifth,
|
|
491
|
-
sixth: (value: UnwrapValue<Fifth>) => Sixth,
|
|
492
|
-
seventh: (value: UnwrapValue<Sixth>) => Seventh,
|
|
493
|
-
): WrapValue<Seventh>;
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* Attempt to pipe a result through a series of functions
|
|
497
|
-
* @param initial Initial result
|
|
498
|
-
* @returns Piped result
|
|
499
|
-
*/
|
|
500
|
-
export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(
|
|
501
|
-
initial: Result<Initial>,
|
|
502
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
503
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
504
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
505
|
-
fourth: (value: UnwrapValue<Third>) => Fourth,
|
|
506
|
-
fifth: (value: UnwrapValue<Fourth>) => Fifth,
|
|
507
|
-
sixth: (value: UnwrapValue<Fifth>) => Sixth,
|
|
508
|
-
seventh: (value: UnwrapValue<Sixth>) => Seventh,
|
|
509
|
-
eighth: (value: UnwrapValue<Seventh>) => Eighth,
|
|
510
|
-
): WrapValue<Eighth>;
|
|
511
|
-
|
|
512
|
-
/**
|
|
513
|
-
* Attempt to pipe a result through a series of functions
|
|
514
|
-
* @param initial Initial result
|
|
515
|
-
* @returns Piped result
|
|
516
|
-
*/
|
|
517
|
-
export function attemptPipe<
|
|
518
|
-
Initial,
|
|
519
|
-
First,
|
|
520
|
-
Second,
|
|
521
|
-
Third,
|
|
522
|
-
Fourth,
|
|
523
|
-
Fifth,
|
|
524
|
-
Sixth,
|
|
525
|
-
Seventh,
|
|
526
|
-
Eighth,
|
|
527
|
-
Ninth,
|
|
528
|
-
>(
|
|
529
|
-
initial: Result<Initial>,
|
|
530
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
531
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
532
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
533
|
-
fourth: (value: UnwrapValue<Third>) => Fourth,
|
|
534
|
-
fifth: (value: UnwrapValue<Fourth>) => Fifth,
|
|
535
|
-
sixth: (value: UnwrapValue<Fifth>) => Sixth,
|
|
536
|
-
seventh: (value: UnwrapValue<Sixth>) => Seventh,
|
|
537
|
-
eighth: (value: UnwrapValue<Seventh>) => Eighth,
|
|
538
|
-
ninth: (value: UnwrapValue<Eighth>) => Ninth,
|
|
539
|
-
): WrapValue<Ninth>;
|
|
540
|
-
|
|
541
|
-
/**
|
|
542
|
-
* Attempt to pipe a result through a series of functions
|
|
543
|
-
* @param initial Initial result
|
|
544
|
-
* @returns Piped result
|
|
545
|
-
*/
|
|
546
|
-
export function attemptPipe<
|
|
547
|
-
Initial,
|
|
548
|
-
First,
|
|
549
|
-
Second,
|
|
550
|
-
Third,
|
|
551
|
-
Fourth,
|
|
552
|
-
Fifth,
|
|
553
|
-
Sixth,
|
|
554
|
-
Seventh,
|
|
555
|
-
Eighth,
|
|
556
|
-
Ninth,
|
|
557
|
-
Tenth,
|
|
558
|
-
>(
|
|
559
|
-
initial: Result<Initial>,
|
|
560
|
-
first: (value: UnwrapValue<Initial>) => First,
|
|
561
|
-
second: (value: UnwrapValue<First>) => Second,
|
|
562
|
-
third: (value: UnwrapValue<Second>) => Third,
|
|
563
|
-
fourth: (value: UnwrapValue<Third>) => Fourth,
|
|
564
|
-
fifth: (value: UnwrapValue<Fourth>) => Fifth,
|
|
565
|
-
sixth: (value: UnwrapValue<Fifth>) => Sixth,
|
|
566
|
-
seventh: (value: UnwrapValue<Sixth>) => Seventh,
|
|
567
|
-
eighth: (value: UnwrapValue<Seventh>) => Eighth,
|
|
568
|
-
ninth: (value: UnwrapValue<Eighth>) => Ninth,
|
|
569
|
-
tenth: (value: UnwrapValue<Ninth>) => Tenth,
|
|
570
|
-
): WrapValue<Tenth>;
|
|
571
|
-
|
|
572
266
|
/**
|
|
573
267
|
* Attempt to pipe a value through a function
|
|
268
|
+
*
|
|
269
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
574
270
|
* @param initial Initial value
|
|
575
271
|
* @returns Piped result
|
|
576
272
|
*/
|
|
577
273
|
export function attemptPipe<Initial, Pipe>(
|
|
578
|
-
initial: GenericCallback | Initial
|
|
274
|
+
initial: GenericCallback | Initial | Result<Initial>,
|
|
579
275
|
pipe: (value: UnwrapValue<Initial>) => Pipe,
|
|
580
276
|
): WrapValue<Pipe>;
|
|
581
277
|
|
|
582
278
|
/**
|
|
583
279
|
* Attempt to pipe a value through a series of functions
|
|
280
|
+
*
|
|
281
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
584
282
|
* @param initial Initial value
|
|
585
283
|
* @returns Piped result
|
|
586
284
|
*/
|
|
587
285
|
export function attemptPipe<Initial, First, Second>(
|
|
588
|
-
initial: GenericCallback | Initial
|
|
286
|
+
initial: GenericCallback | Initial | Result<Initial>,
|
|
589
287
|
first: (value: UnwrapValue<Initial>) => First,
|
|
590
288
|
second: (value: UnwrapValue<First>) => Second,
|
|
591
289
|
): WrapValue<Second>;
|
|
592
290
|
|
|
593
291
|
/**
|
|
594
292
|
* Attempt to pipe a value through a series of functions
|
|
293
|
+
*
|
|
294
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
595
295
|
* @param initial Initial value
|
|
596
296
|
* @returns Piped result
|
|
597
297
|
*/
|
|
598
298
|
export function attemptPipe<Initial, First, Second, Third>(
|
|
599
|
-
initial: GenericCallback | Initial
|
|
299
|
+
initial: GenericCallback | Initial | Result<Initial>,
|
|
600
300
|
first: (value: UnwrapValue<Initial>) => First,
|
|
601
301
|
second: (value: UnwrapValue<First>) => Second,
|
|
602
302
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -604,11 +304,13 @@ export function attemptPipe<Initial, First, Second, Third>(
|
|
|
604
304
|
|
|
605
305
|
/**
|
|
606
306
|
* Attempt to pipe a value through a series of functions
|
|
307
|
+
*
|
|
308
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
607
309
|
* @param initial Initial value
|
|
608
310
|
* @returns Piped result
|
|
609
311
|
*/
|
|
610
312
|
export function attemptPipe<Initial, First, Second, Third, Fourth>(
|
|
611
|
-
initial: GenericCallback | Initial
|
|
313
|
+
initial: GenericCallback | Initial | Result<Initial>,
|
|
612
314
|
first: (value: UnwrapValue<Initial>) => First,
|
|
613
315
|
second: (value: UnwrapValue<First>) => Second,
|
|
614
316
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -617,11 +319,13 @@ export function attemptPipe<Initial, First, Second, Third, Fourth>(
|
|
|
617
319
|
|
|
618
320
|
/**
|
|
619
321
|
* Attempt to pipe a value through a series of functions
|
|
322
|
+
*
|
|
323
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
620
324
|
* @param initial Initial value
|
|
621
325
|
* @returns Piped result
|
|
622
326
|
*/
|
|
623
327
|
export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth>(
|
|
624
|
-
initial: GenericCallback | Initial
|
|
328
|
+
initial: GenericCallback | Initial | Result<Initial>,
|
|
625
329
|
first: (value: UnwrapValue<Initial>) => First,
|
|
626
330
|
second: (value: UnwrapValue<First>) => Second,
|
|
627
331
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -631,11 +335,13 @@ export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth>(
|
|
|
631
335
|
|
|
632
336
|
/**
|
|
633
337
|
* Attempt to pipe a value through a series of functions
|
|
338
|
+
*
|
|
339
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
634
340
|
* @param initial Initial value
|
|
635
341
|
* @returns Piped result
|
|
636
342
|
*/
|
|
637
343
|
export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(
|
|
638
|
-
initial: GenericCallback | Initial
|
|
344
|
+
initial: GenericCallback | Initial | Result<Initial>,
|
|
639
345
|
first: (value: UnwrapValue<Initial>) => First,
|
|
640
346
|
second: (value: UnwrapValue<First>) => Second,
|
|
641
347
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -646,11 +352,13 @@ export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>
|
|
|
646
352
|
|
|
647
353
|
/**
|
|
648
354
|
* Attempt to pipe a value through a series of functions
|
|
355
|
+
*
|
|
356
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
649
357
|
* @param initial Initial value
|
|
650
358
|
* @returns Piped result
|
|
651
359
|
*/
|
|
652
360
|
export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(
|
|
653
|
-
initial: GenericCallback | Initial
|
|
361
|
+
initial: GenericCallback | Initial | Result<Initial>,
|
|
654
362
|
first: (value: UnwrapValue<Initial>) => First,
|
|
655
363
|
second: (value: UnwrapValue<First>) => Second,
|
|
656
364
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -662,11 +370,13 @@ export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth,
|
|
|
662
370
|
|
|
663
371
|
/**
|
|
664
372
|
* Attempt to pipe a value through a series of functions
|
|
373
|
+
*
|
|
374
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
665
375
|
* @param initial Initial value
|
|
666
376
|
* @returns Piped result
|
|
667
377
|
*/
|
|
668
378
|
export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(
|
|
669
|
-
initial: GenericCallback | Initial
|
|
379
|
+
initial: GenericCallback | Initial | Result<Initial>,
|
|
670
380
|
first: (value: UnwrapValue<Initial>) => First,
|
|
671
381
|
second: (value: UnwrapValue<First>) => Second,
|
|
672
382
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -679,6 +389,8 @@ export function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth,
|
|
|
679
389
|
|
|
680
390
|
/**
|
|
681
391
|
* Attempt to pipe a value through a series of functions
|
|
392
|
+
*
|
|
393
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
682
394
|
* @param initial Initial value
|
|
683
395
|
* @returns Piped result
|
|
684
396
|
*/
|
|
@@ -694,7 +406,7 @@ export function attemptPipe<
|
|
|
694
406
|
Eighth,
|
|
695
407
|
Ninth,
|
|
696
408
|
>(
|
|
697
|
-
initial: GenericCallback | Initial
|
|
409
|
+
initial: GenericCallback | Initial | Result<Initial>,
|
|
698
410
|
first: (value: UnwrapValue<Initial>) => First,
|
|
699
411
|
second: (value: UnwrapValue<First>) => Second,
|
|
700
412
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -708,6 +420,8 @@ export function attemptPipe<
|
|
|
708
420
|
|
|
709
421
|
/**
|
|
710
422
|
* Attempt to pipe a value through a series of functions
|
|
423
|
+
*
|
|
424
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
711
425
|
* @param initial Initial value
|
|
712
426
|
* @returns Piped result
|
|
713
427
|
*/
|
|
@@ -724,7 +438,7 @@ export function attemptPipe<
|
|
|
724
438
|
Ninth,
|
|
725
439
|
Tenth,
|
|
726
440
|
>(
|
|
727
|
-
initial: GenericCallback | Initial
|
|
441
|
+
initial: GenericCallback | Initial | Result<Initial>,
|
|
728
442
|
first: (value: UnwrapValue<Initial>) => First,
|
|
729
443
|
second: (value: UnwrapValue<First>) => Second,
|
|
730
444
|
third: (value: UnwrapValue<Second>) => Third,
|
|
@@ -739,22 +453,13 @@ export function attemptPipe<
|
|
|
739
453
|
|
|
740
454
|
/**
|
|
741
455
|
* Attempt to pipe a result through a series of functions
|
|
456
|
+
*
|
|
457
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
742
458
|
* @param initial Initial result
|
|
743
459
|
* @returns Piped result
|
|
744
460
|
*/
|
|
745
461
|
export function attemptPipe<Initial>(
|
|
746
|
-
initial: Result<Initial>,
|
|
747
|
-
first?: (value: UnwrapValue<Initial>) => unknown,
|
|
748
|
-
...seconds: Array<(value: unknown) => unknown>
|
|
749
|
-
): WrapValue<Initial>;
|
|
750
|
-
|
|
751
|
-
/**
|
|
752
|
-
* Attempt to pipe an item through a series of functions
|
|
753
|
-
* @param item Initial value
|
|
754
|
-
* @returns Piped result
|
|
755
|
-
*/
|
|
756
|
-
export function attemptPipe<Initial>(
|
|
757
|
-
initial: GenericCallback | Initial,
|
|
462
|
+
initial: GenericCallback | Initial | Result<Initial>,
|
|
758
463
|
first?: (value: UnwrapValue<Initial>) => unknown,
|
|
759
464
|
...seconds: Array<(value: unknown) => unknown>
|
|
760
465
|
): WrapValue<Initial>;
|