@xstd/async-function 1.1.0 → 1.2.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/package.json +1 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/index.js.map +1 -1
- package/src/types/methods/map-arguments/built-in/map-one-argument.d.ts +16 -0
- package/src/types/methods/map-arguments/built-in/map-one-argument.js +18 -0
- package/src/types/methods/map-arguments/built-in/map-one-argument.js.map +1 -0
- package/src/types/methods/map-arguments/built-in/set-arguments.d.ts +14 -0
- package/src/types/methods/map-arguments/built-in/set-arguments.js +16 -0
- package/src/types/methods/map-arguments/built-in/set-arguments.js.map +1 -0
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -7,3 +7,5 @@ export * from './types/methods/then/async-function.then.on-fulfilled-function.ts
|
|
|
7
7
|
export * from './types/methods/then/async-function.then.on-rejected-function.ts';
|
|
8
8
|
export * from './types/methods/share-concurent-calls/share-concurent-calls-options.ts';
|
|
9
9
|
export * from './types/methods/map-arguments/map-function-arguments.ts';
|
|
10
|
+
export * from './types/methods/map-arguments/built-in/map-one-argument.ts';
|
|
11
|
+
export * from './types/methods/map-arguments/built-in/set-arguments.ts';
|
package/src/index.js
CHANGED
|
@@ -7,4 +7,6 @@ export * from './types/methods/then/async-function.then.on-fulfilled-function.js
|
|
|
7
7
|
export * from './types/methods/then/async-function.then.on-rejected-function.js';
|
|
8
8
|
export * from './types/methods/share-concurent-calls/share-concurent-calls-options.js';
|
|
9
9
|
export * from './types/methods/map-arguments/map-function-arguments.js';
|
|
10
|
+
export * from './types/methods/map-arguments/built-in/map-one-argument.js';
|
|
11
|
+
export * from './types/methods/map-arguments/built-in/set-arguments.js';
|
|
10
12
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8FAA8F,CAAC;AAC7G,cAAc,gEAAgE,CAAC;AAC/E,cAAc,mEAAmE,CAAC;AAClF,cAAc,kEAAkE,CAAC;AACjF,cAAc,wEAAwE,CAAC;AACvF,cAAc,yDAAyD,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8FAA8F,CAAC;AAC7G,cAAc,gEAAgE,CAAC;AAC/E,cAAc,mEAAmE,CAAC;AAClF,cAAc,kEAAkE,CAAC;AACjF,cAAc,wEAAwE,CAAC;AACvF,cAAc,yDAAyD,CAAC;AACxE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,yDAAyD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MapFunctionArguments } from '../map-function-arguments.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Used to map the first argument of a Flow to another one.
|
|
4
|
+
*
|
|
5
|
+
* @template GIn - The type of the source argument.
|
|
6
|
+
* @template GOut - The type of the destination argument.
|
|
7
|
+
* @param {(value: GIn) => GOut} mapFnc - The function to map the source argument to the destination one.
|
|
8
|
+
* @returns {MapFunctionArguments<[GOut], [GIn]>} - A function that maps one argument to another one.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* const value = await fnc.mapArguments(mapOneArgument(Number)).call(signal, '10');
|
|
14
|
+
* ``
|
|
15
|
+
*/
|
|
16
|
+
export declare function mapOneArgument<GIn, GOut>(mapFnc: (value: GIn) => GOut): MapFunctionArguments<[GOut], [GIn]>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Used to map the first argument of a Flow to another one.
|
|
3
|
+
*
|
|
4
|
+
* @template GIn - The type of the source argument.
|
|
5
|
+
* @template GOut - The type of the destination argument.
|
|
6
|
+
* @param {(value: GIn) => GOut} mapFnc - The function to map the source argument to the destination one.
|
|
7
|
+
* @returns {MapFunctionArguments<[GOut], [GIn]>} - A function that maps one argument to another one.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* const value = await fnc.mapArguments(mapOneArgument(Number)).call(signal, '10');
|
|
13
|
+
* ``
|
|
14
|
+
*/
|
|
15
|
+
export function mapOneArgument(mapFnc) {
|
|
16
|
+
return (value) => [mapFnc(value)];
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=map-one-argument.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-one-argument.js","sourceRoot":"","sources":["../../../../../../src/types/methods/map-arguments/built-in/map-one-argument.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc,CAAY,MAA4B;IACpE,OAAO,CAAC,KAAU,EAAU,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MapFunctionArguments } from '../map-function-arguments.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Used to set the arguments of an AsyncFunction.
|
|
4
|
+
*
|
|
5
|
+
* @param args - The arguments to set.
|
|
6
|
+
* @returns {MapFunctionArguments<GArguments, []>} - A function that maps no arguments to a list of predefined ones.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* const value = await fnc.mapArguments(setArguments(10)).call(signal);
|
|
12
|
+
* ``
|
|
13
|
+
*/
|
|
14
|
+
export declare function setArguments<GArguments extends readonly unknown[]>(...args: GArguments): MapFunctionArguments<GArguments, []>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Used to set the arguments of an AsyncFunction.
|
|
3
|
+
*
|
|
4
|
+
* @param args - The arguments to set.
|
|
5
|
+
* @returns {MapFunctionArguments<GArguments, []>} - A function that maps no arguments to a list of predefined ones.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* const value = await fnc.mapArguments(setArguments(10)).call(signal);
|
|
11
|
+
* ``
|
|
12
|
+
*/
|
|
13
|
+
export function setArguments(...args) {
|
|
14
|
+
return () => args;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=set-arguments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-arguments.js","sourceRoot":"","sources":["../../../../../../src/types/methods/map-arguments/built-in/set-arguments.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAC1B,GAAG,IAAgB;IAEnB,OAAO,GAAe,EAAE,CAAC,IAAI,CAAC;AAChC,CAAC"}
|