-
Notifications
You must be signed in to change notification settings - Fork 15
/
compose.d.ts
25 lines (25 loc) · 941 Bytes
/
compose.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
export = compose;
/**
* @name compose
*
* @synopsis
* ```coffeescript [specscript]
* compose(funcs Array<function>)(...args) -> result Promise|any
*
* compose(...args, funcs Array<function>) -> result Promise|any
* ```
*
* @description
* Creates a function composition from an array of functions, where each function passes its return value as a single argument to the previous function until all functions have executed. The last function is called with the arguments to the composition, while the result of a function composition is the return value of its first function. If any function of the composition is asynchronous, the result of the execution is a Promise. `compose` is effectively `pipe` in reverse.
*
* ```javascript [playground]
* const f = number => number * 2
*
* const g = number => number + 3
*
* console.log(
* compose(5, [f, g]),
* ) // 16
* ```
*/
declare function compose(...args: any[]): any;