pipe
constpipe:PipeFn
Defined in: functions/pipe/index.ts:35
Composes functions left-to-right into a single function. The first function receives the initial arguments; each subsequent function receives the previous function’s return value.
Functions to compose, executed in the order provided
Returns
Section titled “Returns”A function that applies every fn in sequence
Example
Section titled “Example”const slug = pipe( (x: string) => x.trim(), (x: string) => x.toLowerCase(), (x: string) => x.replace(/\s+/g, "-"),);
slug(" Hello World "); // "hello-world"Keywords
Section titled “Keywords”compose, function composition, flow, left-to-right, pipeline, chain, sequence, combine functions
TC39 pipe operator proposal (https://github.com/tc39/proposal-pipeline-operator)
Throws
Section titled “Throws”Error if any argument is not a function
Remarks
Section titled “Remarks”With zero arguments, returns an identity function that passes its first
argument through unchanged. Execution is synchronous — if a function returns
a Promise, the next function receives the Promise (not the awaited value).
Only the first function receives the caller’s this context; subsequent
stages are called without this (differs from lodash/flow and
es-toolkit/flow, which forward this to every stage).