Skip to content

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 ParameterDescription
TThe input and output type / 输入输出类型

Parameters ​

ParameterTypeDescription
...funcs(arg) => T[]The functions to compose / 要组合的函数

Returns ​

A composed function / 组合后的函数

(arg) => T

Example ​

ts
pipe((value) => value + 1, (value) => value * 2)(3)
// => 8

Since ​

1.2.0

Released under the MIT License.