@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/dist/result/misc.d.mts
CHANGED
|
@@ -4,14 +4,14 @@ import { isError, isOk, isResult } from "../internal/result.mjs";
|
|
|
4
4
|
//#region src/result/misc.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Creates an extended error result
|
|
7
|
-
* @param
|
|
7
|
+
* @param value Error value
|
|
8
8
|
* @param original Original error
|
|
9
9
|
* @returns Error result
|
|
10
10
|
*/
|
|
11
11
|
declare function error<E>(value: E, original: Error): ExtendedErr<E>;
|
|
12
12
|
/**
|
|
13
13
|
* Creates an error result
|
|
14
|
-
* @param
|
|
14
|
+
* @param value Error value
|
|
15
15
|
* @returns Error result
|
|
16
16
|
*/
|
|
17
17
|
declare function error<E>(value: E): Err<E>;
|
|
@@ -26,7 +26,7 @@ declare function ok<Value>(value: Value): Ok<Value>;
|
|
|
26
26
|
* Converts a result to a promise
|
|
27
27
|
*
|
|
28
28
|
* Resolves if ok, rejects for error
|
|
29
|
-
* @param
|
|
29
|
+
* @param callback Callback to get the result
|
|
30
30
|
* @returns Promised result
|
|
31
31
|
*/
|
|
32
32
|
declare function toPromise<Value, E = Error>(callback: () => AnyResult<Value, E>): Promise<Value>;
|
|
@@ -12,121 +12,169 @@ type AttemptFlow<Callback extends GenericCallback, Value> = (...args: Parameters
|
|
|
12
12
|
type AttemptFlowPromise<Callback extends GenericCallback, Value> = (...args: Parameters<Callback>) => Promise<Result<UnwrapValue<Value>>>;
|
|
13
13
|
/**
|
|
14
14
|
* Create an asynchronous Flow, a function that attempts to pipe a value through a series of functions
|
|
15
|
+
*
|
|
16
|
+
* Available as `attemptAsyncFlow` and `attempt.flow.async`
|
|
15
17
|
* @returns Flow function
|
|
16
18
|
*/
|
|
17
19
|
declare function attemptAsyncFlow<Fn extends GenericCallback>(fn: Fn): AttemptFlowPromise<Fn, ReturnType<Fn>>;
|
|
18
20
|
/**
|
|
19
21
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
22
|
+
*
|
|
23
|
+
* Available as `attemptAsyncFlow` and `attempt.flow.async`
|
|
20
24
|
* @returns Flow function
|
|
21
25
|
*/
|
|
22
26
|
declare function attemptAsyncFlow<First extends GenericCallback, Second>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second): AttemptFlowPromise<First, Second>;
|
|
23
27
|
/**
|
|
24
28
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
29
|
+
*
|
|
30
|
+
* Available as `attemptAsyncFlow` and `attempt.flow.async`
|
|
25
31
|
* @returns Flow function
|
|
26
32
|
*/
|
|
27
33
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third): AttemptFlowPromise<First, Third>;
|
|
28
34
|
/**
|
|
29
35
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
36
|
+
*
|
|
37
|
+
* Available as `attemptAsyncFlow` and `attempt.flow.async`
|
|
30
38
|
* @returns Flow function
|
|
31
39
|
*/
|
|
32
40
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth): AttemptFlowPromise<First, Fourth>;
|
|
33
41
|
/**
|
|
34
42
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
43
|
+
*
|
|
44
|
+
* Available as `attemptAsyncFlow` and `attempt.flow.async`
|
|
35
45
|
* @returns Flow function
|
|
36
46
|
*/
|
|
37
47
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth): AttemptFlowPromise<First, Fifth>;
|
|
38
48
|
/**
|
|
39
49
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
50
|
+
*
|
|
51
|
+
* Available as `attemptAsyncFlow` and `attempt.flow.async`
|
|
40
52
|
* @returns Flow function
|
|
41
53
|
*/
|
|
42
54
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth): AttemptFlowPromise<First, Sixth>;
|
|
43
55
|
/**
|
|
44
56
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
57
|
+
*
|
|
58
|
+
* Available as `attemptAsyncFlow` and `attempt.flow.async`
|
|
45
59
|
* @returns Flow function
|
|
46
60
|
*/
|
|
47
61
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh): AttemptFlowPromise<First, Seventh>;
|
|
48
62
|
/**
|
|
49
63
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
64
|
+
*
|
|
65
|
+
* Available as `attemptAsyncFlow` and `attempt.flow.async`
|
|
50
66
|
* @returns Flow function
|
|
51
67
|
*/
|
|
52
68
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh, eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth): AttemptFlowPromise<First, Eighth>;
|
|
53
69
|
/**
|
|
54
70
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
71
|
+
*
|
|
72
|
+
* Available as `attemptAsyncFlow` and `attempt.flow.async`
|
|
55
73
|
* @returns Flow function
|
|
56
74
|
*/
|
|
57
75
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh, eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth, ninth: (value: Awaited<UnwrapValue<Eighth>>) => Ninth): AttemptFlowPromise<First, Ninth>;
|
|
58
76
|
/**
|
|
59
77
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
78
|
+
*
|
|
79
|
+
* Available as `attemptAsyncFlow` and `attempt.flow.async`
|
|
60
80
|
* @returns Flow function
|
|
61
81
|
*/
|
|
62
82
|
declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh, eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth, ninth: (value: Awaited<UnwrapValue<Eighth>>) => Ninth, tenth: (value: Awaited<UnwrapValue<Ninth>>) => Tenth): AttemptFlowPromise<First, Tenth>;
|
|
63
83
|
/**
|
|
64
84
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
85
|
+
*
|
|
86
|
+
* Available as `attemptAsyncFlow` and `attempt.flow.async`
|
|
65
87
|
* @returns Flow function
|
|
66
88
|
*/
|
|
67
89
|
declare function attemptAsyncFlow<Fn extends GenericCallback>(fn: Fn, ...fns: Array<(value: Awaited<UnwrapValue<ReturnType<Fn>>>) => unknown>): AttemptFlowPromise<Fn, ReturnType<Fn>>;
|
|
68
90
|
/**
|
|
69
91
|
* Create an asynchronous Flow, a function that pipes values through a series of functions
|
|
92
|
+
*
|
|
93
|
+
* Available as `attemptAsyncFlow` and `attempt.flow.async`
|
|
70
94
|
* @returns Flow function
|
|
71
95
|
*/
|
|
72
96
|
declare function attemptAsyncFlow(...fns: GenericCallback[]): (...args: unknown[]) => Promise<Result<unknown>>;
|
|
73
97
|
/**
|
|
74
98
|
* Create a Flow, a function that attempts to pipe values through a function
|
|
99
|
+
*
|
|
100
|
+
* Available as `attemptFlow` and `attempt.flow`
|
|
75
101
|
* @returns Flow function
|
|
76
102
|
*/
|
|
77
103
|
declare function attemptFlow<Fn extends GenericCallback>(fn: Fn): AttemptFlow<Fn, ReturnType<Fn>>;
|
|
78
104
|
/**
|
|
79
105
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
106
|
+
*
|
|
107
|
+
* Available as `attemptFlow` and `attempt.flow`
|
|
80
108
|
* @returns Flow function
|
|
81
109
|
*/
|
|
82
110
|
declare function attemptFlow<First extends GenericCallback, Second>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second): AttemptFlow<First, Second>;
|
|
83
111
|
/**
|
|
84
112
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
113
|
+
*
|
|
114
|
+
* Available as `attemptFlow` and `attempt.flow`
|
|
85
115
|
* @returns Flow function
|
|
86
116
|
*/
|
|
87
117
|
declare function attemptFlow<First extends GenericCallback, Second, Third>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third): AttemptFlow<First, Third>;
|
|
88
118
|
/**
|
|
89
119
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
120
|
+
*
|
|
121
|
+
* Available as `attemptFlow` and `attempt.flow`
|
|
90
122
|
* @returns Flow function
|
|
91
123
|
*/
|
|
92
124
|
declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth): AttemptFlow<First, Fourth>;
|
|
93
125
|
/**
|
|
94
126
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
127
|
+
*
|
|
128
|
+
* Available as `attemptFlow` and `attempt.flow`
|
|
95
129
|
* @returns Flow function
|
|
96
130
|
*/
|
|
97
131
|
declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth): AttemptFlow<First, Fifth>;
|
|
98
132
|
/**
|
|
99
133
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
134
|
+
*
|
|
135
|
+
* Available as `attemptFlow` and `attempt.flow`
|
|
100
136
|
* @returns Flow function
|
|
101
137
|
*/
|
|
102
138
|
declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth): AttemptFlow<First, Sixth>;
|
|
103
139
|
/**
|
|
104
140
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
141
|
+
*
|
|
142
|
+
* Available as `attemptFlow` and `attempt.flow`
|
|
105
143
|
* @returns Flow function
|
|
106
144
|
*/
|
|
107
145
|
declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh): AttemptFlow<First, Seventh>;
|
|
108
146
|
/**
|
|
109
147
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
148
|
+
*
|
|
149
|
+
* Available as `attemptFlow` and `attempt.flow`
|
|
110
150
|
* @returns Flow function
|
|
111
151
|
*/
|
|
112
152
|
declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth): AttemptFlow<First, Eighth>;
|
|
113
153
|
/**
|
|
114
154
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
155
|
+
*
|
|
156
|
+
* Available as `attemptFlow` and `attempt.flow`
|
|
115
157
|
* @returns Flow function
|
|
116
158
|
*/
|
|
117
159
|
declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth): AttemptFlow<First, Ninth>;
|
|
118
160
|
/**
|
|
119
161
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
162
|
+
*
|
|
163
|
+
* Available as `attemptFlow` and `attempt.flow`
|
|
120
164
|
* @returns Flow function
|
|
121
165
|
*/
|
|
122
166
|
declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth, tenth: (value: UnwrapValue<Ninth>) => Tenth): AttemptFlow<First, Tenth>;
|
|
123
167
|
/**
|
|
124
168
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
169
|
+
*
|
|
170
|
+
* Available as `attemptFlow` and `attempt.flow`
|
|
125
171
|
* @returns Flow function
|
|
126
172
|
*/
|
|
127
173
|
declare function attemptFlow<First extends GenericCallback>(first: First, ...fns: Array<(value: UnwrapValue<ReturnType<First>>) => unknown>): AttemptFlow<First, ReturnType<First>>;
|
|
128
174
|
/**
|
|
129
175
|
* Create a Flow, a function that attempts to pipe values through a series of functions
|
|
176
|
+
*
|
|
177
|
+
* Available as `attemptFlow` and `attempt.flow`
|
|
130
178
|
* @returns Flow function
|
|
131
179
|
*/
|
|
132
180
|
declare function attemptFlow(...fns: GenericCallback[]): (...args: unknown[]) => Result<unknown>;
|
|
@@ -134,4 +182,4 @@ declare namespace attemptFlow {
|
|
|
134
182
|
var async: typeof attemptAsyncFlow;
|
|
135
183
|
}
|
|
136
184
|
//#endregion
|
|
137
|
-
export { AttemptFlow, AttemptFlowPromise, attemptFlow };
|
|
185
|
+
export { AttemptFlow, AttemptFlowPromise, attemptAsyncFlow, attemptFlow };
|
|
@@ -3,272 +3,184 @@ import { Result, UnwrapValue } from "../models.mjs";
|
|
|
3
3
|
|
|
4
4
|
//#region src/result/work/pipe.d.ts
|
|
5
5
|
type WrapValue<Value> = Result<UnwrapValue<Value>>;
|
|
6
|
-
/**
|
|
7
|
-
* Attempt to pipe a result through a function
|
|
8
|
-
* @param initial Initial result
|
|
9
|
-
* @returns Piped result
|
|
10
|
-
*/
|
|
11
|
-
declare function attemptAsyncPipe<Initial, Piped>(initial: Result<Initial>, pipe: (value: UnwrapValue<Initial>) => Piped): Promise<WrapValue<Piped>>;
|
|
12
|
-
/**
|
|
13
|
-
* Attempt to pipe a result through a series of functions
|
|
14
|
-
* @param initial Initial result
|
|
15
|
-
* @returns Piped result
|
|
16
|
-
*/
|
|
17
|
-
declare function attemptAsyncPipe<Initial, First, Second>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second): Promise<WrapValue<Second>>;
|
|
18
|
-
/**
|
|
19
|
-
* Attempt to pipe a result through a series of functions
|
|
20
|
-
* @param initial Initial result
|
|
21
|
-
* @returns Piped result
|
|
22
|
-
*/
|
|
23
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third): Promise<WrapValue<Third>>;
|
|
24
|
-
/**
|
|
25
|
-
* Attempt to pipe a result through a series of functions
|
|
26
|
-
* @param initial Initial result
|
|
27
|
-
* @returns Piped result
|
|
28
|
-
*/
|
|
29
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth): Promise<WrapValue<Fourth>>;
|
|
30
|
-
/**
|
|
31
|
-
* Attempt to pipe a result through a series of functions
|
|
32
|
-
* @param initial Initial result
|
|
33
|
-
* @returns Piped result
|
|
34
|
-
*/
|
|
35
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth): Promise<WrapValue<Fifth>>;
|
|
36
|
-
/**
|
|
37
|
-
* Attempt to pipe a result through a series of functions
|
|
38
|
-
* @param initial Initial result
|
|
39
|
-
* @returns Piped result
|
|
40
|
-
*/
|
|
41
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth): Promise<WrapValue<Sixth>>;
|
|
42
|
-
/**
|
|
43
|
-
* Attempt to pipe a result through a series of functions
|
|
44
|
-
* @param initial Initial result
|
|
45
|
-
* @returns Piped result
|
|
46
|
-
*/
|
|
47
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh): Promise<WrapValue<Seventh>>;
|
|
48
|
-
/**
|
|
49
|
-
* Attempt to pipe a result through a series of functions
|
|
50
|
-
* @param initial Initial result
|
|
51
|
-
* @returns Piped result
|
|
52
|
-
*/
|
|
53
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth): Promise<WrapValue<Eighth>>;
|
|
54
|
-
/**
|
|
55
|
-
* Attempt to pipe a result through a series of functions
|
|
56
|
-
* @param initial Initial result
|
|
57
|
-
* @returns Piped result
|
|
58
|
-
*/
|
|
59
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth): Promise<WrapValue<Ninth>>;
|
|
60
|
-
/**
|
|
61
|
-
* Attempt to pipe a result through a series of functions
|
|
62
|
-
* @param initial Initial result
|
|
63
|
-
* @returns Piped result
|
|
64
|
-
*/
|
|
65
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth, tenth: (value: UnwrapValue<Ninth>) => Tenth): Promise<WrapValue<Tenth>>;
|
|
66
6
|
/**
|
|
67
7
|
* Attempt to pipe a value through a function
|
|
8
|
+
*
|
|
9
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
68
10
|
* @param initial Initial value
|
|
69
11
|
* @returns Piped result
|
|
70
12
|
*/
|
|
71
|
-
declare function attemptAsyncPipe<Initial, Piped>(initial: GenericCallback | Initial
|
|
13
|
+
declare function attemptAsyncPipe<Initial, Piped>(initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>, pipe: (value: UnwrapValue<Initial>) => Piped): Promise<WrapValue<Piped>>;
|
|
72
14
|
/**
|
|
73
15
|
* Attempt to pipe a value through a series of functions
|
|
16
|
+
*
|
|
17
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
74
18
|
* @param initial Initial value
|
|
75
19
|
* @returns Piped result
|
|
76
20
|
*/
|
|
77
|
-
declare function attemptAsyncPipe<Initial, First, Second>(initial: GenericCallback | Initial
|
|
21
|
+
declare function attemptAsyncPipe<Initial, First, Second>(initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second): Promise<WrapValue<Second>>;
|
|
78
22
|
/**
|
|
79
23
|
* Attempt to pipe a value through a series of functions
|
|
24
|
+
*
|
|
25
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
80
26
|
* @param initial Initial value
|
|
81
27
|
* @returns Piped result
|
|
82
28
|
*/
|
|
83
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third>(initial: GenericCallback | Initial
|
|
29
|
+
declare function attemptAsyncPipe<Initial, First, Second, Third>(initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third): Promise<WrapValue<Third>>;
|
|
84
30
|
/**
|
|
85
31
|
* Attempt to pipe a value through a series of functions
|
|
32
|
+
*
|
|
33
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
86
34
|
* @param initial Initial value
|
|
87
35
|
* @returns Piped result
|
|
88
36
|
*/
|
|
89
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth>(initial: GenericCallback | Initial
|
|
37
|
+
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth>(initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth): Promise<WrapValue<Fourth>>;
|
|
90
38
|
/**
|
|
91
39
|
* Attempt to pipe a value through a series of functions
|
|
40
|
+
*
|
|
41
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
92
42
|
* @param initial Initial value
|
|
93
43
|
* @returns Piped result
|
|
94
44
|
*/
|
|
95
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth>(initial: GenericCallback | Initial
|
|
45
|
+
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth>(initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth): Promise<WrapValue<Fifth>>;
|
|
96
46
|
/**
|
|
97
47
|
* Attempt to pipe a value through a series of functions
|
|
48
|
+
*
|
|
49
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
98
50
|
* @param initial Initial value
|
|
99
51
|
* @returns Piped result
|
|
100
52
|
*/
|
|
101
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(initial: GenericCallback | Initial
|
|
53
|
+
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth): Promise<WrapValue<Sixth>>;
|
|
102
54
|
/**
|
|
103
55
|
* Attempt to pipe a value through a series of functions
|
|
56
|
+
*
|
|
57
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
104
58
|
* @param initial Initial value
|
|
105
59
|
* @returns Piped result
|
|
106
60
|
*/
|
|
107
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(initial: GenericCallback | Initial
|
|
61
|
+
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh): Promise<WrapValue<Seventh>>;
|
|
108
62
|
/**
|
|
109
63
|
* Attempt to pipe a value through a series of functions
|
|
64
|
+
*
|
|
65
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
110
66
|
* @param initial Initial value
|
|
111
67
|
* @returns Piped result
|
|
112
68
|
*/
|
|
113
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(initial: GenericCallback | Initial
|
|
69
|
+
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth): Promise<WrapValue<Eighth>>;
|
|
114
70
|
/**
|
|
115
71
|
* Attempt to pipe a value through a series of functions
|
|
72
|
+
*
|
|
73
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
116
74
|
* @param initial Initial value
|
|
117
75
|
* @returns Piped result
|
|
118
76
|
*/
|
|
119
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(initial: GenericCallback | Initial
|
|
77
|
+
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth): Promise<WrapValue<Ninth>>;
|
|
120
78
|
/**
|
|
121
79
|
* Attempt to pipe a value through a series of functions
|
|
80
|
+
*
|
|
81
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
122
82
|
* @param initial Initial value
|
|
123
83
|
* @returns Piped result
|
|
124
84
|
*/
|
|
125
|
-
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(initial: GenericCallback | Initial
|
|
126
|
-
/**
|
|
127
|
-
* Attempt to pipe a result through a series of functions
|
|
128
|
-
* @param initial Initial result
|
|
129
|
-
* @returns Piped result
|
|
130
|
-
*/
|
|
131
|
-
declare function attemptAsyncPipe<Initial>(initial: Result<Initial>, first?: (value: UnwrapValue<Initial>) => unknown, ...seconds: Array<(value: unknown) => unknown>): Promise<WrapValue<Initial>>;
|
|
132
|
-
/**
|
|
133
|
-
* Attempt to pipe an item through a series of functions
|
|
134
|
-
* @param item Initial value
|
|
135
|
-
* @returns Piped result
|
|
136
|
-
*/
|
|
137
|
-
declare function attemptAsyncPipe<Initial>(initial: GenericCallback | Initial, first?: (value: UnwrapValue<Initial>) => unknown, ...seconds: Array<(value: unknown) => unknown>): Promise<WrapValue<Initial>>;
|
|
138
|
-
/**
|
|
139
|
-
* Attempt to pipe a result through a function
|
|
140
|
-
* @param initial Initial result
|
|
141
|
-
* @returns Piped result
|
|
142
|
-
*/
|
|
143
|
-
declare function attemptPipe<Initial, Piped>(initial: Result<Initial>, pipe: (value: UnwrapValue<Initial>) => Piped): WrapValue<Piped>;
|
|
144
|
-
/**
|
|
145
|
-
* Attempt to pipe a result through a series of functions
|
|
146
|
-
* @param initial Initial result
|
|
147
|
-
* @returns Piped result
|
|
148
|
-
*/
|
|
149
|
-
declare function attemptPipe<Initial, First, Second>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second): WrapValue<Second>;
|
|
150
|
-
/**
|
|
151
|
-
* Attempt to pipe a result through a series of functions
|
|
152
|
-
* @param initial Initial result
|
|
153
|
-
* @returns Piped result
|
|
154
|
-
*/
|
|
155
|
-
declare function attemptPipe<Initial, First, Second, Third>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third): WrapValue<Third>;
|
|
156
|
-
/**
|
|
157
|
-
* Attempt to pipe a result through a series of functions
|
|
158
|
-
* @param initial Initial result
|
|
159
|
-
* @returns Piped result
|
|
160
|
-
*/
|
|
161
|
-
declare function attemptPipe<Initial, First, Second, Third, Fourth>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth): WrapValue<Fourth>;
|
|
162
|
-
/**
|
|
163
|
-
* Attempt to pipe a result through a series of functions
|
|
164
|
-
* @param initial Initial result
|
|
165
|
-
* @returns Piped result
|
|
166
|
-
*/
|
|
167
|
-
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth): WrapValue<Fifth>;
|
|
168
|
-
/**
|
|
169
|
-
* Attempt to pipe a result through a series of functions
|
|
170
|
-
* @param initial Initial result
|
|
171
|
-
* @returns Piped result
|
|
172
|
-
*/
|
|
173
|
-
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth): WrapValue<Sixth>;
|
|
174
|
-
/**
|
|
175
|
-
* Attempt to pipe a result through a series of functions
|
|
176
|
-
* @param initial Initial result
|
|
177
|
-
* @returns Piped result
|
|
178
|
-
*/
|
|
179
|
-
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh): WrapValue<Seventh>;
|
|
85
|
+
declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth, tenth: (value: UnwrapValue<Ninth>) => Tenth): Promise<WrapValue<Tenth>>;
|
|
180
86
|
/**
|
|
181
87
|
* Attempt to pipe a result through a series of functions
|
|
88
|
+
*
|
|
89
|
+
* Available as `attemptAsyncPipe` and `attempt.pipe.async`
|
|
182
90
|
* @param initial Initial result
|
|
183
91
|
* @returns Piped result
|
|
184
92
|
*/
|
|
185
|
-
declare function
|
|
186
|
-
/**
|
|
187
|
-
* Attempt to pipe a result through a series of functions
|
|
188
|
-
* @param initial Initial result
|
|
189
|
-
* @returns Piped result
|
|
190
|
-
*/
|
|
191
|
-
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth): WrapValue<Ninth>;
|
|
192
|
-
/**
|
|
193
|
-
* Attempt to pipe a result through a series of functions
|
|
194
|
-
* @param initial Initial result
|
|
195
|
-
* @returns Piped result
|
|
196
|
-
*/
|
|
197
|
-
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(initial: Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth, tenth: (value: UnwrapValue<Ninth>) => Tenth): WrapValue<Tenth>;
|
|
93
|
+
declare function attemptAsyncPipe<Initial>(initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>, first?: (value: UnwrapValue<Initial>) => unknown, ...seconds: Array<(value: unknown) => unknown>): Promise<WrapValue<Initial>>;
|
|
198
94
|
/**
|
|
199
95
|
* Attempt to pipe a value through a function
|
|
96
|
+
*
|
|
97
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
200
98
|
* @param initial Initial value
|
|
201
99
|
* @returns Piped result
|
|
202
100
|
*/
|
|
203
|
-
declare function attemptPipe<Initial, Pipe>(initial: GenericCallback | Initial
|
|
101
|
+
declare function attemptPipe<Initial, Pipe>(initial: GenericCallback | Initial | Result<Initial>, pipe: (value: UnwrapValue<Initial>) => Pipe): WrapValue<Pipe>;
|
|
204
102
|
/**
|
|
205
103
|
* Attempt to pipe a value through a series of functions
|
|
104
|
+
*
|
|
105
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
206
106
|
* @param initial Initial value
|
|
207
107
|
* @returns Piped result
|
|
208
108
|
*/
|
|
209
|
-
declare function attemptPipe<Initial, First, Second>(initial: GenericCallback | Initial
|
|
109
|
+
declare function attemptPipe<Initial, First, Second>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second): WrapValue<Second>;
|
|
210
110
|
/**
|
|
211
111
|
* Attempt to pipe a value through a series of functions
|
|
112
|
+
*
|
|
113
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
212
114
|
* @param initial Initial value
|
|
213
115
|
* @returns Piped result
|
|
214
116
|
*/
|
|
215
|
-
declare function attemptPipe<Initial, First, Second, Third>(initial: GenericCallback | Initial
|
|
117
|
+
declare function attemptPipe<Initial, First, Second, Third>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third): WrapValue<Third>;
|
|
216
118
|
/**
|
|
217
119
|
* Attempt to pipe a value through a series of functions
|
|
120
|
+
*
|
|
121
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
218
122
|
* @param initial Initial value
|
|
219
123
|
* @returns Piped result
|
|
220
124
|
*/
|
|
221
|
-
declare function attemptPipe<Initial, First, Second, Third, Fourth>(initial: GenericCallback | Initial
|
|
125
|
+
declare function attemptPipe<Initial, First, Second, Third, Fourth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth): WrapValue<Fourth>;
|
|
222
126
|
/**
|
|
223
127
|
* Attempt to pipe a value through a series of functions
|
|
128
|
+
*
|
|
129
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
224
130
|
* @param initial Initial value
|
|
225
131
|
* @returns Piped result
|
|
226
132
|
*/
|
|
227
|
-
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth>(initial: GenericCallback | Initial
|
|
133
|
+
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth): WrapValue<Fifth>;
|
|
228
134
|
/**
|
|
229
135
|
* Attempt to pipe a value through a series of functions
|
|
136
|
+
*
|
|
137
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
230
138
|
* @param initial Initial value
|
|
231
139
|
* @returns Piped result
|
|
232
140
|
*/
|
|
233
|
-
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(initial: GenericCallback | Initial
|
|
141
|
+
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth): WrapValue<Sixth>;
|
|
234
142
|
/**
|
|
235
143
|
* Attempt to pipe a value through a series of functions
|
|
144
|
+
*
|
|
145
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
236
146
|
* @param initial Initial value
|
|
237
147
|
* @returns Piped result
|
|
238
148
|
*/
|
|
239
|
-
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(initial: GenericCallback | Initial
|
|
149
|
+
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh): WrapValue<Seventh>;
|
|
240
150
|
/**
|
|
241
151
|
* Attempt to pipe a value through a series of functions
|
|
152
|
+
*
|
|
153
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
242
154
|
* @param initial Initial value
|
|
243
155
|
* @returns Piped result
|
|
244
156
|
*/
|
|
245
|
-
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(initial: GenericCallback | Initial
|
|
157
|
+
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth): WrapValue<Eighth>;
|
|
246
158
|
/**
|
|
247
159
|
* Attempt to pipe a value through a series of functions
|
|
160
|
+
*
|
|
161
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
248
162
|
* @param initial Initial value
|
|
249
163
|
* @returns Piped result
|
|
250
164
|
*/
|
|
251
|
-
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(initial: GenericCallback | Initial
|
|
165
|
+
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth): WrapValue<Ninth>;
|
|
252
166
|
/**
|
|
253
167
|
* Attempt to pipe a value through a series of functions
|
|
168
|
+
*
|
|
169
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
254
170
|
* @param initial Initial value
|
|
255
171
|
* @returns Piped result
|
|
256
172
|
*/
|
|
257
|
-
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(initial: GenericCallback | Initial
|
|
173
|
+
declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth, tenth: (value: UnwrapValue<Ninth>) => Tenth): WrapValue<Tenth>;
|
|
258
174
|
/**
|
|
259
175
|
* Attempt to pipe a result through a series of functions
|
|
176
|
+
*
|
|
177
|
+
* Available as `attemptPipe` and `attempt.pipe`
|
|
260
178
|
* @param initial Initial result
|
|
261
179
|
* @returns Piped result
|
|
262
180
|
*/
|
|
263
|
-
declare function attemptPipe<Initial>(initial: Result<Initial>, first?: (value: UnwrapValue<Initial>) => unknown, ...seconds: Array<(value: unknown) => unknown>): WrapValue<Initial>;
|
|
264
|
-
/**
|
|
265
|
-
* Attempt to pipe an item through a series of functions
|
|
266
|
-
* @param item Initial value
|
|
267
|
-
* @returns Piped result
|
|
268
|
-
*/
|
|
269
|
-
declare function attemptPipe<Initial>(initial: GenericCallback | Initial, first?: (value: UnwrapValue<Initial>) => unknown, ...seconds: Array<(value: unknown) => unknown>): WrapValue<Initial>;
|
|
181
|
+
declare function attemptPipe<Initial>(initial: GenericCallback | Initial | Result<Initial>, first?: (value: UnwrapValue<Initial>) => unknown, ...seconds: Array<(value: unknown) => unknown>): WrapValue<Initial>;
|
|
270
182
|
declare namespace attemptPipe {
|
|
271
183
|
var async: typeof attemptAsyncPipe;
|
|
272
184
|
}
|
|
273
185
|
//#endregion
|
|
274
|
-
export { attemptPipe };
|
|
186
|
+
export { attemptAsyncPipe, attemptPipe };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isError, isOk } from "../../internal/result.mjs";
|
|
2
|
-
import { pipe } from "../../function/work.mjs";
|
|
2
|
+
import { asyncPipe, pipe } from "../../function/work.mjs";
|
|
3
3
|
import { attempt } from "../index.mjs";
|
|
4
4
|
//#region src/result/work/pipe.ts
|
|
5
5
|
async function attemptAsyncPipe(initial, first, ...seconds) {
|
|
@@ -7,7 +7,7 @@ async function attemptAsyncPipe(initial, first, ...seconds) {
|
|
|
7
7
|
if (isError(initial)) throw initial.error;
|
|
8
8
|
const value = typeof initial === "function" ? initial() : isOk(initial) ? initial.value : initial;
|
|
9
9
|
if (first == null) return value;
|
|
10
|
-
return
|
|
10
|
+
return asyncPipe(value, ...[first, ...seconds]);
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
function attemptPipe(initial, first, ...seconds) {
|
|
@@ -20,4 +20,4 @@ function attemptPipe(initial, first, ...seconds) {
|
|
|
20
20
|
}
|
|
21
21
|
attemptPipe.async = attemptAsyncPipe;
|
|
22
22
|
//#endregion
|
|
23
|
-
export { attemptPipe };
|
|
23
|
+
export { attemptAsyncPipe, attemptPipe };
|
package/dist/string/fuzzy.d.mts
CHANGED
|
@@ -106,5 +106,15 @@ declare function fuzzy<Item>(items: Item[], handler?: (item: Item) => string): F
|
|
|
106
106
|
* @returns Fuzzy searcher
|
|
107
107
|
*/
|
|
108
108
|
declare function fuzzy<Item>(items: Item[], configuration?: FuzzyConfiguration<Item>): Fuzzy<Item>;
|
|
109
|
+
declare namespace fuzzy {
|
|
110
|
+
var match: typeof fuzzyMatch;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Does the needle match the haystack in a fuzzy way?
|
|
114
|
+
* @param haystack Haystack to search through
|
|
115
|
+
* @param needle Needle to search for
|
|
116
|
+
* @returns `true` if the needle matches the haystack in a fuzzy way, `false` otherwise
|
|
117
|
+
*/
|
|
118
|
+
declare function fuzzyMatch(haystack: string, needle: string): boolean;
|
|
109
119
|
//#endregion
|
|
110
|
-
export { FuzzyConfiguration, FuzzyOptions, FuzzyResult, FuzzySearchOptions, fuzzy };
|
|
120
|
+
export { FuzzyConfiguration, FuzzyOptions, FuzzyResult, FuzzySearchOptions, fuzzy, fuzzyMatch };
|