@nlozgachev/pipelined 0.14.0 → 0.16.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.
@@ -220,6 +220,40 @@ var RemoteData;
220
220
  RemoteData2.toResult = (onNotReady) => (data) => (0, RemoteData2.isSuccess)(data) ? Result.ok(data.value) : Result.err((0, RemoteData2.isFailure)(data) ? data.error : onNotReady());
221
221
  })(RemoteData || (RemoteData = {}));
222
222
 
223
+ // src/Core/Resource.ts
224
+ var Resource;
225
+ ((Resource2) => {
226
+ Resource2.make = (acquire, release) => ({ acquire, release });
227
+ Resource2.fromTask = (acquire, release) => ({
228
+ acquire: Task.map((a) => Result.ok(a))(acquire),
229
+ release
230
+ });
231
+ Resource2.use = (f) => (resource) => Task.from(
232
+ () => Deferred.toPromise(resource.acquire()).then(async (acquired) => {
233
+ if (Result.isErr(acquired)) return acquired;
234
+ const a = acquired.value;
235
+ const usageResult = await Deferred.toPromise(f(a)());
236
+ await Deferred.toPromise(resource.release(a)());
237
+ return usageResult;
238
+ })
239
+ );
240
+ Resource2.combine = (resourceA, resourceB) => ({
241
+ acquire: Task.from(
242
+ () => Deferred.toPromise(resourceA.acquire()).then(async (acquiredA) => {
243
+ if (Result.isErr(acquiredA)) return acquiredA;
244
+ const a = acquiredA.value;
245
+ const acquiredB = await Deferred.toPromise(resourceB.acquire());
246
+ if (Result.isErr(acquiredB)) {
247
+ await Deferred.toPromise(resourceA.release(a)());
248
+ return acquiredB;
249
+ }
250
+ return Result.ok([a, acquiredB.value]);
251
+ })
252
+ ),
253
+ release: ([a, b]) => Task.from(() => Deferred.toPromise(resourceB.release(b)()).then(() => Deferred.toPromise(resourceA.release(a)())))
254
+ });
255
+ })(Resource || (Resource = {}));
256
+
223
257
  // src/Core/State.ts
224
258
  var State;
225
259
  ((State2) => {
@@ -504,6 +538,7 @@ export {
504
538
  Reader,
505
539
  Refinement,
506
540
  RemoteData,
541
+ Resource,
507
542
  State,
508
543
  TaskOption,
509
544
  TaskResult,
@@ -0,0 +1,242 @@
1
+ // src/Composition/compose.ts
2
+ function compose(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9) {
3
+ const len = arguments.length;
4
+ switch (len) {
5
+ case 1:
6
+ return f0;
7
+ case 2:
8
+ return function() {
9
+ return f0(f1.apply(this, arguments));
10
+ };
11
+ case 3:
12
+ return function() {
13
+ return f0(f1(f2.apply(this, arguments)));
14
+ };
15
+ case 4:
16
+ return function() {
17
+ return f0(f1(f2(f3.apply(this, arguments))));
18
+ };
19
+ case 5:
20
+ return function() {
21
+ return f0(f1(f2(f3(f4.apply(this, arguments)))));
22
+ };
23
+ case 6:
24
+ return function() {
25
+ return f0(f1(f2(f3(f4(f5.apply(this, arguments))))));
26
+ };
27
+ case 7:
28
+ return function() {
29
+ return f0(f1(f2(f3(f4(f5(f6.apply(this, arguments)))))));
30
+ };
31
+ case 8:
32
+ return function() {
33
+ return f0(f1(f2(f3(f4(f5(f6(f7.apply(this, arguments))))))));
34
+ };
35
+ case 9:
36
+ return function() {
37
+ return f0(f1(f2(f3(f4(f5(f6(f7(f8.apply(this, arguments)))))))));
38
+ };
39
+ case 10:
40
+ return function() {
41
+ return f0(f1(f2(f3(f4(f5(f6(f7(f8(f9.apply(this, arguments))))))))));
42
+ };
43
+ }
44
+ return f0;
45
+ }
46
+
47
+ // src/Composition/converge.ts
48
+ function converge(f, transformers) {
49
+ return (a) => f(...transformers.map((t) => t(a)));
50
+ }
51
+
52
+ // src/Composition/curry.ts
53
+ var curry = (f) => (a) => (b) => f(a, b);
54
+ var curry3 = (f) => (a) => (b) => (c) => f(a, b, c);
55
+ var curry4 = (f) => (a) => (b) => (c) => (d) => f(a, b, c, d);
56
+
57
+ // src/Composition/flip.ts
58
+ var flip = (f) => (b) => (a) => f(a)(b);
59
+
60
+ // src/Composition/flow.ts
61
+ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij, jk) {
62
+ const len = arguments.length;
63
+ switch (len) {
64
+ case 0:
65
+ return function(...args) {
66
+ return args[0];
67
+ };
68
+ case 1:
69
+ return ab;
70
+ case 2:
71
+ return function() {
72
+ return bc(ab.apply(this, arguments));
73
+ };
74
+ case 3:
75
+ return function() {
76
+ return cd(bc(ab.apply(this, arguments)));
77
+ };
78
+ case 4:
79
+ return function() {
80
+ return de(cd(bc(ab.apply(this, arguments))));
81
+ };
82
+ case 5:
83
+ return function() {
84
+ return ef(de(cd(bc(ab.apply(this, arguments)))));
85
+ };
86
+ case 6:
87
+ return function() {
88
+ return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
89
+ };
90
+ case 7:
91
+ return function() {
92
+ return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
93
+ };
94
+ case 8:
95
+ return function() {
96
+ return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
97
+ };
98
+ case 9:
99
+ return function() {
100
+ return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
101
+ };
102
+ case 10:
103
+ return function() {
104
+ return jk(ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))))));
105
+ };
106
+ }
107
+ return ab;
108
+ }
109
+
110
+ // src/Composition/fn.ts
111
+ var identity = (a) => a;
112
+ var constant = (a) => () => a;
113
+ var constTrue = () => true;
114
+ var constFalse = () => false;
115
+ var constNull = () => null;
116
+ var constUndefined = () => void 0;
117
+ var constVoid = () => {
118
+ };
119
+ var and = (p1, p2) => (...args) => p1(...args) && p2(...args);
120
+ var or = (p1, p2) => (...args) => p1(...args) || p2(...args);
121
+ var once = (f) => {
122
+ let called = false;
123
+ let result;
124
+ return () => {
125
+ if (!called) {
126
+ result = f();
127
+ called = true;
128
+ }
129
+ return result;
130
+ };
131
+ };
132
+
133
+ // src/Composition/juxt.ts
134
+ function juxt(fns) {
135
+ return (a) => fns.map((f) => f(a));
136
+ }
137
+
138
+ // src/Composition/memoize.ts
139
+ var memoize = (f, keyFn = (a) => a) => {
140
+ const cache = /* @__PURE__ */ new Map();
141
+ return (a) => {
142
+ const key = keyFn(a);
143
+ if (cache.has(key)) {
144
+ return cache.get(key);
145
+ }
146
+ const result = f(a);
147
+ cache.set(key, result);
148
+ return result;
149
+ };
150
+ };
151
+ var memoizeWeak = (f) => {
152
+ const cache = /* @__PURE__ */ new WeakMap();
153
+ return (a) => {
154
+ if (cache.has(a)) {
155
+ return cache.get(a);
156
+ }
157
+ const result = f(a);
158
+ cache.set(a, result);
159
+ return result;
160
+ };
161
+ };
162
+
163
+ // src/Composition/not.ts
164
+ var not = (predicate) => (...args) => !predicate(...args);
165
+
166
+ // src/Composition/on.ts
167
+ var on = (f, g) => (a, b) => f(g(a), g(b));
168
+
169
+ // src/Composition/pipe.ts
170
+ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi, ij, jk) {
171
+ const len = arguments.length;
172
+ switch (len) {
173
+ case 1:
174
+ return a;
175
+ case 2:
176
+ return ab(a);
177
+ case 3:
178
+ return bc(ab(a));
179
+ case 4:
180
+ return cd(bc(ab(a)));
181
+ case 5:
182
+ return de(cd(bc(ab(a))));
183
+ case 6:
184
+ return ef(de(cd(bc(ab(a)))));
185
+ case 7:
186
+ return fg(ef(de(cd(bc(ab(a))))));
187
+ case 8:
188
+ return gh(fg(ef(de(cd(bc(ab(a)))))));
189
+ case 9:
190
+ return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
191
+ case 10:
192
+ return ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))));
193
+ case 11:
194
+ return jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))));
195
+ }
196
+ }
197
+
198
+ // src/Composition/tap.ts
199
+ var tap = (f) => (a) => {
200
+ f(a);
201
+ return a;
202
+ };
203
+
204
+ // src/Composition/uncurry.ts
205
+ function uncurry(f) {
206
+ return (...args) => {
207
+ const inner = f(...args.slice(0, f.length));
208
+ return inner.length === 0 ? inner() : inner(...args.slice(f.length));
209
+ };
210
+ }
211
+ var uncurry3 = (f) => (a, b, c) => f(a)(b)(c);
212
+ var uncurry4 = (f) => (a, b, c, d) => f(a)(b)(c)(d);
213
+
214
+ export {
215
+ compose,
216
+ converge,
217
+ curry,
218
+ curry3,
219
+ curry4,
220
+ flip,
221
+ flow,
222
+ identity,
223
+ constant,
224
+ constTrue,
225
+ constFalse,
226
+ constNull,
227
+ constUndefined,
228
+ constVoid,
229
+ and,
230
+ or,
231
+ once,
232
+ juxt,
233
+ memoize,
234
+ memoizeWeak,
235
+ not,
236
+ on,
237
+ pipe,
238
+ tap,
239
+ uncurry,
240
+ uncurry3,
241
+ uncurry4
242
+ };
@@ -19,6 +19,9 @@
19
19
  * flowed(5); // 12 ((5 + 1) * 2)
20
20
  * ```
21
21
  *
22
+ * Fully typed for up to 10 steps. Beyond that TypeScript raises a compile error —
23
+ * use a cast or split the pipeline into named intermediate functions.
24
+ *
22
25
  * @see {@link flow} for left-to-right composition
23
26
  */
24
27
  declare function compose<A, B>(ab: (a: A) => B): (a: A) => B;
@@ -30,6 +33,7 @@ declare function compose<A, B, C, D, E, F, G>(fg: (f: F) => G, ef: (e: E) => F,
30
33
  declare function compose<A, B, C, D, E, F, G, H>(gh: (g: G) => H, fg: (f: F) => G, ef: (e: E) => F, de: (d: D) => E, cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => H;
31
34
  declare function compose<A, B, C, D, E, F, G, H, I>(hi: (h: H) => I, gh: (g: G) => H, fg: (f: F) => G, ef: (e: E) => F, de: (d: D) => E, cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => I;
32
35
  declare function compose<A, B, C, D, E, F, G, H, I, J>(ij: (i: I) => J, hi: (h: H) => I, gh: (g: G) => H, fg: (f: F) => G, ef: (e: E) => F, de: (d: D) => E, cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => J;
36
+ declare function compose<A, B, C, D, E, F, G, H, I, J, K>(jk: (j: J) => K, ij: (i: I) => J, hi: (h: H) => I, gh: (g: G) => H, fg: (f: F) => G, ef: (e: E) => F, de: (d: D) => E, cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => K;
33
37
 
34
38
  /**
35
39
  * Applies an input to several transformer functions independently, then passes all results to a
@@ -124,6 +128,9 @@ declare const flip: <A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C
124
128
  * Use `flow` when you want to create a named, reusable transformation.
125
129
  * Use `pipe` when you want to immediately transform a value.
126
130
  *
131
+ * Fully typed for up to 10 steps. Beyond that TypeScript raises a compile error — split into named
132
+ * intermediate functions or use a cast.
133
+ *
127
134
  * @example
128
135
  * ```ts
129
136
  * // Create a reusable transformation
@@ -162,15 +169,6 @@ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H>(ab:
162
169
  declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I): (...a: A) => I;
163
170
  declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J): (...a: A) => J;
164
171
  declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K): (...a: A) => K;
165
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L): (...a: A) => L;
166
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M): (...a: A) => M;
167
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N): (...a: A) => N;
168
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O): (...a: A) => O;
169
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P): (...a: A) => P;
170
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q): (...a: A) => Q;
171
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R): (...a: A) => R;
172
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S): (...a: A) => S;
173
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S, st: (s: S) => T): (...a: A) => T;
174
172
 
175
173
  /**
176
174
  * Returns the value unchanged. The identity function.
@@ -359,6 +357,9 @@ declare const on: <A, B, C>(f: (b1: B, b2: B) => C, g: (a: A) => B) => (a: A, b:
359
357
  * It makes code read top-to-bottom, left-to-right, which is more
360
358
  * intuitive for developers coming from imperative backgrounds.
361
359
  *
360
+ * Fully typed for up to 10 steps. Beyond that TypeScript raises a compile error — split into named
361
+ * intermediate functions or use a cast.
362
+ *
362
363
  * @example
363
364
  * ```ts
364
365
  * // Basic usage
@@ -397,15 +398,6 @@ declare function pipe<A, B, C, D, E, F, G, H>(a: A, ab: (a: A) => B, bc: (b: B)
397
398
  declare function pipe<A, B, C, D, E, F, G, H, I>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I): I;
398
399
  declare function pipe<A, B, C, D, E, F, G, H, I, J>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J): J;
399
400
  declare function pipe<A, B, C, D, E, F, G, H, I, J, K>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K): K;
400
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L): L;
401
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M): M;
402
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N): N;
403
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O): O;
404
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P): P;
405
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q): Q;
406
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R): R;
407
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S): S;
408
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S, st: (s: S) => T): T;
409
401
 
410
402
  /**
411
403
  * Executes a side effect function and returns the original value unchanged.
@@ -19,6 +19,9 @@
19
19
  * flowed(5); // 12 ((5 + 1) * 2)
20
20
  * ```
21
21
  *
22
+ * Fully typed for up to 10 steps. Beyond that TypeScript raises a compile error —
23
+ * use a cast or split the pipeline into named intermediate functions.
24
+ *
22
25
  * @see {@link flow} for left-to-right composition
23
26
  */
24
27
  declare function compose<A, B>(ab: (a: A) => B): (a: A) => B;
@@ -30,6 +33,7 @@ declare function compose<A, B, C, D, E, F, G>(fg: (f: F) => G, ef: (e: E) => F,
30
33
  declare function compose<A, B, C, D, E, F, G, H>(gh: (g: G) => H, fg: (f: F) => G, ef: (e: E) => F, de: (d: D) => E, cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => H;
31
34
  declare function compose<A, B, C, D, E, F, G, H, I>(hi: (h: H) => I, gh: (g: G) => H, fg: (f: F) => G, ef: (e: E) => F, de: (d: D) => E, cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => I;
32
35
  declare function compose<A, B, C, D, E, F, G, H, I, J>(ij: (i: I) => J, hi: (h: H) => I, gh: (g: G) => H, fg: (f: F) => G, ef: (e: E) => F, de: (d: D) => E, cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => J;
36
+ declare function compose<A, B, C, D, E, F, G, H, I, J, K>(jk: (j: J) => K, ij: (i: I) => J, hi: (h: H) => I, gh: (g: G) => H, fg: (f: F) => G, ef: (e: E) => F, de: (d: D) => E, cd: (c: C) => D, bc: (b: B) => C, ab: (a: A) => B): (a: A) => K;
33
37
 
34
38
  /**
35
39
  * Applies an input to several transformer functions independently, then passes all results to a
@@ -124,6 +128,9 @@ declare const flip: <A, B, C>(f: (a: A) => (b: B) => C) => (b: B) => (a: A) => C
124
128
  * Use `flow` when you want to create a named, reusable transformation.
125
129
  * Use `pipe` when you want to immediately transform a value.
126
130
  *
131
+ * Fully typed for up to 10 steps. Beyond that TypeScript raises a compile error — split into named
132
+ * intermediate functions or use a cast.
133
+ *
127
134
  * @example
128
135
  * ```ts
129
136
  * // Create a reusable transformation
@@ -162,15 +169,6 @@ declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H>(ab:
162
169
  declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I): (...a: A) => I;
163
170
  declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J): (...a: A) => J;
164
171
  declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K): (...a: A) => K;
165
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L): (...a: A) => L;
166
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M): (...a: A) => M;
167
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N): (...a: A) => N;
168
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O): (...a: A) => O;
169
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P): (...a: A) => P;
170
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q): (...a: A) => Q;
171
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R): (...a: A) => R;
172
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S): (...a: A) => S;
173
- declare function flow<A extends ReadonlyArray<unknown>, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S, st: (s: S) => T): (...a: A) => T;
174
172
 
175
173
  /**
176
174
  * Returns the value unchanged. The identity function.
@@ -359,6 +357,9 @@ declare const on: <A, B, C>(f: (b1: B, b2: B) => C, g: (a: A) => B) => (a: A, b:
359
357
  * It makes code read top-to-bottom, left-to-right, which is more
360
358
  * intuitive for developers coming from imperative backgrounds.
361
359
  *
360
+ * Fully typed for up to 10 steps. Beyond that TypeScript raises a compile error — split into named
361
+ * intermediate functions or use a cast.
362
+ *
362
363
  * @example
363
364
  * ```ts
364
365
  * // Basic usage
@@ -397,15 +398,6 @@ declare function pipe<A, B, C, D, E, F, G, H>(a: A, ab: (a: A) => B, bc: (b: B)
397
398
  declare function pipe<A, B, C, D, E, F, G, H, I>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I): I;
398
399
  declare function pipe<A, B, C, D, E, F, G, H, I, J>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J): J;
399
400
  declare function pipe<A, B, C, D, E, F, G, H, I, J, K>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K): K;
400
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L): L;
401
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M): M;
402
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N): N;
403
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O): O;
404
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P): P;
405
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q): Q;
406
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R): R;
407
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S): S;
408
- declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(a: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J, jk: (j: J) => K, kl: (k: K) => L, lm: (l: L) => M, mn: (m: M) => N, no: (n: N) => O, op: (o: O) => P, pq: (p: P) => Q, qr: (q: Q) => R, rs: (r: R) => S, st: (s: S) => T): T;
409
401
 
410
402
  /**
411
403
  * Executes a side effect function and returns the original value unchanged.
@@ -51,8 +51,49 @@ __export(Composition_exports, {
51
51
  module.exports = __toCommonJS(Composition_exports);
52
52
 
53
53
  // src/Composition/compose.ts
54
- function compose(...fns) {
55
- return (arg) => fns.reduceRight((acc, fn) => fn(acc), arg);
54
+ function compose(f0, f1, f2, f3, f4, f5, f6, f7, f8, f9) {
55
+ const len = arguments.length;
56
+ switch (len) {
57
+ case 1:
58
+ return f0;
59
+ case 2:
60
+ return function() {
61
+ return f0(f1.apply(this, arguments));
62
+ };
63
+ case 3:
64
+ return function() {
65
+ return f0(f1(f2.apply(this, arguments)));
66
+ };
67
+ case 4:
68
+ return function() {
69
+ return f0(f1(f2(f3.apply(this, arguments))));
70
+ };
71
+ case 5:
72
+ return function() {
73
+ return f0(f1(f2(f3(f4.apply(this, arguments)))));
74
+ };
75
+ case 6:
76
+ return function() {
77
+ return f0(f1(f2(f3(f4(f5.apply(this, arguments))))));
78
+ };
79
+ case 7:
80
+ return function() {
81
+ return f0(f1(f2(f3(f4(f5(f6.apply(this, arguments)))))));
82
+ };
83
+ case 8:
84
+ return function() {
85
+ return f0(f1(f2(f3(f4(f5(f6(f7.apply(this, arguments))))))));
86
+ };
87
+ case 9:
88
+ return function() {
89
+ return f0(f1(f2(f3(f4(f5(f6(f7(f8.apply(this, arguments)))))))));
90
+ };
91
+ case 10:
92
+ return function() {
93
+ return f0(f1(f2(f3(f4(f5(f6(f7(f8(f9.apply(this, arguments))))))))));
94
+ };
95
+ }
96
+ return f0;
56
97
  }
57
98
 
58
99
  // src/Composition/converge.ts
@@ -69,12 +110,53 @@ var curry4 = (f) => (a) => (b) => (c) => (d) => f(a, b, c, d);
69
110
  var flip = (f) => (b) => (a) => f(a)(b);
70
111
 
71
112
  // src/Composition/flow.ts
72
- function flow(...fns) {
73
- return (...args) => {
74
- if (fns.length === 0) return args[0];
75
- const [first, ...rest] = fns;
76
- return rest.reduce((acc, fn) => fn(acc), first(...args));
77
- };
113
+ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij, jk) {
114
+ const len = arguments.length;
115
+ switch (len) {
116
+ case 0:
117
+ return function(...args) {
118
+ return args[0];
119
+ };
120
+ case 1:
121
+ return ab;
122
+ case 2:
123
+ return function() {
124
+ return bc(ab.apply(this, arguments));
125
+ };
126
+ case 3:
127
+ return function() {
128
+ return cd(bc(ab.apply(this, arguments)));
129
+ };
130
+ case 4:
131
+ return function() {
132
+ return de(cd(bc(ab.apply(this, arguments))));
133
+ };
134
+ case 5:
135
+ return function() {
136
+ return ef(de(cd(bc(ab.apply(this, arguments)))));
137
+ };
138
+ case 6:
139
+ return function() {
140
+ return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
141
+ };
142
+ case 7:
143
+ return function() {
144
+ return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
145
+ };
146
+ case 8:
147
+ return function() {
148
+ return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
149
+ };
150
+ case 9:
151
+ return function() {
152
+ return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
153
+ };
154
+ case 10:
155
+ return function() {
156
+ return jk(ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))))));
157
+ };
158
+ }
159
+ return ab;
78
160
  }
79
161
 
80
162
  // src/Composition/fn.ts
@@ -137,8 +219,32 @@ var not = (predicate) => (...args) => !predicate(...args);
137
219
  var on = (f, g) => (a, b) => f(g(a), g(b));
138
220
 
139
221
  // src/Composition/pipe.ts
140
- function pipe(a, ...fns) {
141
- return fns.reduce((acc, fn) => fn(acc), a);
222
+ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi, ij, jk) {
223
+ const len = arguments.length;
224
+ switch (len) {
225
+ case 1:
226
+ return a;
227
+ case 2:
228
+ return ab(a);
229
+ case 3:
230
+ return bc(ab(a));
231
+ case 4:
232
+ return cd(bc(ab(a)));
233
+ case 5:
234
+ return de(cd(bc(ab(a))));
235
+ case 6:
236
+ return ef(de(cd(bc(ab(a)))));
237
+ case 7:
238
+ return fg(ef(de(cd(bc(ab(a))))));
239
+ case 8:
240
+ return gh(fg(ef(de(cd(bc(ab(a)))))));
241
+ case 9:
242
+ return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
243
+ case 10:
244
+ return ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))));
245
+ case 11:
246
+ return jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))));
247
+ }
142
248
  }
143
249
 
144
250
  // src/Composition/tap.ts
@@ -26,7 +26,7 @@ import {
26
26
  uncurry,
27
27
  uncurry3,
28
28
  uncurry4
29
- } from "./chunk-4TXC322E.mjs";
29
+ } from "./chunk-KXAWFKQQ.mjs";
30
30
  export {
31
31
  and,
32
32
  compose,