@thi.ng/compose 3.0.3 → 3.0.5
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/CHANGELOG.md +7 -1
- package/README.md +1 -1
- package/comp.d.ts +1 -1
- package/comp.js +11 -11
- package/complement.js +1 -1
- package/juxt.d.ts +2 -2
- package/package.json +9 -9
- package/partial.js +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-06-21T19:34:38Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [3.0.5](https://github.com/thi-ng/umbrella/tree/@thi.ng/compose@3.0.5) (2024-06-21)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- rename various rest args to be more semantically meaningful ([8088a56](https://github.com/thi-ng/umbrella/commit/8088a56))
|
|
17
|
+
|
|
12
18
|
### [3.0.2](https://github.com/thi-ng/umbrella/tree/@thi.ng/compose@3.0.2) (2024-04-20)
|
|
13
19
|
|
|
14
20
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 193 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
package/comp.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare function compLeft<A, B, C, D, E, F, G>(a: FnAny<A>, b: Fn<A, B>,
|
|
|
30
30
|
export declare function compLeft<A, B, C, D, E, F, G, H>(a: FnAny<A>, b: Fn<A, B>, c: Fn<B, C>, d: Fn<C, D>, e: Fn<D, E>, f: Fn<E, F>, g: Fn<F, G>, h: Fn<G, H>): FnAny<H>;
|
|
31
31
|
export declare function compLeft<A, B, C, D, E, F, G, H, I>(a: FnAny<A>, b: Fn<A, B>, c: Fn<B, C>, d: Fn<C, D>, e: Fn<D, E>, f: Fn<E, F>, g: Fn<F, G>, h: Fn<G, H>, i: Fn<H, I>): FnAny<I>;
|
|
32
32
|
export declare function compLeft<A, B, C, D, E, F, G, H, I, J>(a: FnAny<A>, b: Fn<A, B>, c: Fn<B, C>, d: Fn<C, D>, e: Fn<D, E>, f: Fn<E, F>, g: Fn<F, G>, h: Fn<G, H>, i: Fn<H, I>, j: Fn<I, J>): FnAny<J>;
|
|
33
|
-
export declare function compLeft<A, B, C, D, E, F, G, H, I, J>(a: FnAny<A>, b: Fn<A, B>, c: Fn<B, C>, d: Fn<C, D>, e: Fn<D, E>, f: Fn<E, F>, g: Fn<F, G>, h: Fn<G, H>, i: Fn<H, I>, j: Fn<I, J>, ...
|
|
33
|
+
export declare function compLeft<A, B, C, D, E, F, G, H, I, J>(a: FnAny<A>, b: Fn<A, B>, c: Fn<B, C>, d: Fn<C, D>, e: Fn<D, E>, f: Fn<E, F>, g: Fn<F, G>, h: Fn<G, H>, i: Fn<H, I>, j: Fn<I, J>, ...args: Fn<any, any>[]): FnAny<any>;
|
|
34
34
|
/**
|
|
35
35
|
* @deprecated renamed to {@link compLeft}.
|
|
36
36
|
*/
|
package/comp.js
CHANGED
|
@@ -7,24 +7,24 @@ function comp(...fns) {
|
|
|
7
7
|
case 1:
|
|
8
8
|
return a;
|
|
9
9
|
case 2:
|
|
10
|
-
return (...
|
|
10
|
+
return (...args) => a(b(...args));
|
|
11
11
|
case 3:
|
|
12
|
-
return (...
|
|
12
|
+
return (...args) => a(b(c(...args)));
|
|
13
13
|
case 4:
|
|
14
|
-
return (...
|
|
14
|
+
return (...args) => a(b(c(d(...args))));
|
|
15
15
|
case 5:
|
|
16
|
-
return (...
|
|
16
|
+
return (...args) => a(b(c(d(e(...args)))));
|
|
17
17
|
case 6:
|
|
18
|
-
return (...
|
|
18
|
+
return (...args) => a(b(c(d(e(f(...args))))));
|
|
19
19
|
case 7:
|
|
20
|
-
return (...
|
|
20
|
+
return (...args) => a(b(c(d(e(f(g(...args)))))));
|
|
21
21
|
case 8:
|
|
22
|
-
return (...
|
|
22
|
+
return (...args) => a(b(c(d(e(f(g(h(...args))))))));
|
|
23
23
|
case 9:
|
|
24
|
-
return (...
|
|
24
|
+
return (...args) => a(b(c(d(e(f(g(h(i(...args)))))))));
|
|
25
25
|
case 10:
|
|
26
26
|
default:
|
|
27
|
-
const fn = (...
|
|
27
|
+
const fn = (...args) => a(b(c(d(e(f(g(h(i(j(...args))))))))));
|
|
28
28
|
return fns.length === 10 ? fn : comp(fn, ...fns.slice(10));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -33,9 +33,9 @@ function compLeft(...fns) {
|
|
|
33
33
|
}
|
|
34
34
|
const compL = compLeft;
|
|
35
35
|
function compAsync(...fns) {
|
|
36
|
-
return async (...
|
|
36
|
+
return async (...args) => {
|
|
37
37
|
let n = fns.length - 1;
|
|
38
|
-
let res = fns[n](...
|
|
38
|
+
let res = fns[n](...args);
|
|
39
39
|
while (n-- > 0) {
|
|
40
40
|
res = await fns[n](res);
|
|
41
41
|
}
|
package/complement.js
CHANGED
package/juxt.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare function juxt<T, A, B, C, D, E>(a: Fn<T, A>, b: Fn<T, B>, c: Fn<T
|
|
|
7
7
|
export declare function juxt<T, A, B, C, D, E, F>(a: Fn<T, A>, b: Fn<T, B>, c: Fn<T, C>, d: Fn<T, D>, e: Fn<T, E>, f: Fn<T, F>): Fn<T, [A, B, C, D, E, F]>;
|
|
8
8
|
export declare function juxt<T, A, B, C, D, E, F, G>(a: Fn<T, A>, b: Fn<T, B>, c: Fn<T, C>, d: Fn<T, D>, e: Fn<T, E>, f: Fn<T, F>, g: Fn<T, G>): Fn<T, [A, B, C, D, E, F, G]>;
|
|
9
9
|
export declare function juxt<T, A, B, C, D, E, F, G, H>(a: Fn<T, A>, b: Fn<T, B>, c: Fn<T, C>, d: Fn<T, D>, e: Fn<T, E>, f: Fn<T, F>, g: Fn<T, G>, h: Fn<T, H>): Fn<T, [A, B, C, D, E, F, G, H]>;
|
|
10
|
-
export declare function juxt<T, A, B, C, D, E, F, G, H>(a: Fn<T, A>, b: Fn<T, B>, c: Fn<T, C>, d: Fn<T, D>, e: Fn<T, E>, f: Fn<T, F>, g: Fn<T, G>, h: Fn<T, H>, ...
|
|
10
|
+
export declare function juxt<T, A, B, C, D, E, F, G, H>(a: Fn<T, A>, b: Fn<T, B>, c: Fn<T, C>, d: Fn<T, D>, e: Fn<T, E>, f: Fn<T, F>, g: Fn<T, G>, h: Fn<T, H>, ...args: Fn<T, any>[]): Fn<T, any[]>;
|
|
11
11
|
/**
|
|
12
12
|
* Async version of {@link juxt}. Returns an async function which takes a single
|
|
13
13
|
* arg `x`, calls all given functions with `x` and then waits for all results
|
|
@@ -23,5 +23,5 @@ export declare function juxtAsync<T, A, B, C, D, E>(a: FnA<T, A>, b: FnA<T, B>,
|
|
|
23
23
|
export declare function juxtAsync<T, A, B, C, D, E, F>(a: FnA<T, A>, b: FnA<T, B>, c: FnA<T, C>, d: FnA<T, D>, e: FnA<T, E>, f: FnA<T, F>): FnA<T, [A, B, C, D, E, F]>;
|
|
24
24
|
export declare function juxtAsync<T, A, B, C, D, E, F, G>(a: FnA<T, A>, b: FnA<T, B>, c: FnA<T, C>, d: FnA<T, D>, e: FnA<T, E>, f: FnA<T, F>, g: FnA<T, G>): FnA<T, [A, B, C, D, E, F, G]>;
|
|
25
25
|
export declare function juxtAsync<T, A, B, C, D, E, F, G, H>(a: FnA<T, A>, b: FnA<T, B>, c: FnA<T, C>, d: FnA<T, D>, e: FnA<T, E>, f: FnA<T, F>, g: FnA<T, G>, h: FnA<T, H>): FnA<T, [A, B, C, D, E, F, G, H]>;
|
|
26
|
-
export declare function juxtAsync<T, A, B, C, D, E, F, G, H>(a: FnA<T, A>, b: FnA<T, B>, c: FnA<T, C>, d: FnA<T, D>, e: FnA<T, E>, f: FnA<T, F>, g: FnA<T, G>, h: FnA<T, H>, ...
|
|
26
|
+
export declare function juxtAsync<T, A, B, C, D, E, F, G, H>(a: FnA<T, A>, b: FnA<T, B>, c: FnA<T, C>, d: FnA<T, D>, e: FnA<T, E>, f: FnA<T, F>, g: FnA<T, G>, h: FnA<T, H>, ...args: FnA<T, any>[]): FnA<T, any[]>;
|
|
27
27
|
//# sourceMappingURL=juxt.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/compose",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"description": "Optimized functional composition helpers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://thi.ng/compose",
|
|
14
14
|
"funding": [
|
|
15
15
|
{
|
|
16
16
|
"type": "github",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/errors": "^2.5.
|
|
39
|
+
"@thi.ng/api": "^8.11.3",
|
|
40
|
+
"@thi.ng/errors": "^2.5.8"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@microsoft/api-extractor": "^7.
|
|
44
|
-
"esbuild": "^0.
|
|
45
|
-
"typedoc": "^0.25.
|
|
46
|
-
"typescript": "^5.
|
|
43
|
+
"@microsoft/api-extractor": "^7.47.0",
|
|
44
|
+
"esbuild": "^0.21.5",
|
|
45
|
+
"typedoc": "^0.25.13",
|
|
46
|
+
"typescript": "^5.5.2"
|
|
47
47
|
},
|
|
48
48
|
"keywords": [
|
|
49
49
|
"async",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"thi.ng": {
|
|
106
106
|
"alias": "comp"
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
|
|
109
109
|
}
|
package/partial.js
CHANGED
|
@@ -3,21 +3,21 @@ function partial(fn, ...args) {
|
|
|
3
3
|
let [a, b, c, d, e, f, g, h] = args;
|
|
4
4
|
switch (args.length) {
|
|
5
5
|
case 1:
|
|
6
|
-
return (...
|
|
6
|
+
return (...args2) => fn(a, ...args2);
|
|
7
7
|
case 2:
|
|
8
|
-
return (...
|
|
8
|
+
return (...args2) => fn(a, b, ...args2);
|
|
9
9
|
case 3:
|
|
10
|
-
return (...
|
|
10
|
+
return (...args2) => fn(a, b, c, ...args2);
|
|
11
11
|
case 4:
|
|
12
|
-
return (...
|
|
12
|
+
return (...args2) => fn(a, b, c, d, ...args2);
|
|
13
13
|
case 5:
|
|
14
|
-
return (...
|
|
14
|
+
return (...args2) => fn(a, b, c, d, e, ...args2);
|
|
15
15
|
case 6:
|
|
16
|
-
return (...
|
|
16
|
+
return (...args2) => fn(a, b, c, d, e, f, ...args2);
|
|
17
17
|
case 7:
|
|
18
|
-
return (...
|
|
18
|
+
return (...args2) => fn(a, b, c, d, e, f, g, ...args2);
|
|
19
19
|
case 8:
|
|
20
|
-
return (...
|
|
20
|
+
return (...args2) => fn(a, b, c, d, e, f, g, h, ...args2);
|
|
21
21
|
default:
|
|
22
22
|
illegalArgs();
|
|
23
23
|
}
|