Function: pipe()
ts
function pipe<T>(...funcs): (arg) => T;Composes multiple functions into a single function that executes from left to right. 将多个函数组合成一个从左到右执行的单一函数。
Type Parameters
| Type Parameter | Description |
|---|---|
T | The input and output type / 输入输出类型 |
Parameters
| Parameter | Type | Description |
|---|---|---|
...funcs | (arg) => T[] | The functions to compose / 要组合的函数 |
Returns
A composed function / 组合后的函数
(arg) => T
Example
ts
pipe((value) => value + 1, (value) => value * 2)(3)
// => 8Since
1.2.0