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,ab,bc,cd,de,ef,fg,gh,hi,ij,jk,kl,lm,mn,no,op,pq,qr,rs):S
pipe<
A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T>(a,ab,bc,cd,de,ef,fg,gh,hi,ij,jk,kl,lm,mn,no,op,pq,qr,rs,st):T
Composes functions left-to-right, passing the result of each to the next.
Supports up to 20 functions with full type inference.
Type Parameters
A: A
The type of the initial value.
B: B
C: C
D: D
E: E
F: F
G: G
H: H
I: I
J: J
K: K
L: L
M: M
N: N
O: O
P: P
Q: Q
R: R
S: S
T: T
Parameters
Overload 1:
a: A
Overload 2:
a: A
ab: (a) => B
Overload 3:
a: A
ab: (a) => B
bc: (b) => C
Overload 4:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
Show 16 more overloads
Overload 5:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
Overload 6:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
Overload 7:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
fg: (f) => G
Overload 8:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
fg: (f) => G
gh: (g) => H
Overload 9:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
fg: (f) => G
gh: (g) => H
hi: (h) => I
Overload 10:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
fg: (f) => G
gh: (g) => H
hi: (h) => I
ij: (i) => J
Overload 11:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
fg: (f) => G
gh: (g) => H
hi: (h) => I
ij: (i) => J
jk: (j) => K
Overload 12:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
fg: (f) => G
gh: (g) => H
hi: (h) => I
ij: (i) => J
jk: (j) => K
kl: (k) => L
Overload 13:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
fg: (f) => G
gh: (g) => H
hi: (h) => I
ij: (i) => J
jk: (j) => K
kl: (k) => L
lm: (l) => M
Overload 14:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
fg: (f) => G
gh: (g) => H
hi: (h) => I
ij: (i) => J
jk: (j) => K
kl: (k) => L
lm: (l) => M
mn: (m) => N
Overload 15:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
fg: (f) => G
gh: (g) => H
hi: (h) => I
ij: (i) => J
jk: (j) => K
kl: (k) => L
lm: (l) => M
mn: (m) => N
no: (n) => O
Overload 16:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
fg: (f) => G
gh: (g) => H
hi: (h) => I
ij: (i) => J
jk: (j) => K
kl: (k) => L
lm: (l) => M
mn: (m) => N
no: (n) => O
op: (o) => P
Overload 17:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
fg: (f) => G
gh: (g) => H
hi: (h) => I
ij: (i) => J
jk: (j) => K
kl: (k) => L
lm: (l) => M
mn: (m) => N
no: (n) => O
op: (o) => P
pq: (p) => Q
Overload 18:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
fg: (f) => G
gh: (g) => H
hi: (h) => I
ij: (i) => J
jk: (j) => K
kl: (k) => L
lm: (l) => M
mn: (m) => N
no: (n) => O
op: (o) => P
pq: (p) => Q
qr: (q) => R
Overload 19:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
fg: (f) => G
gh: (g) => H
hi: (h) => I
ij: (i) => J
jk: (j) => K
kl: (k) => L
lm: (l) => M
mn: (m) => N
no: (n) => O
op: (o) => P
pq: (p) => Q
qr: (q) => R
rs: (r) => S
Overload 20:
a: A
ab: (a) => B
bc: (b) => C
cd: (c) => D
de: (d) => E
ef: (e) => F
fg: (f) => G
gh: (g) => H
hi: (h) => I
ij: (i) => J
jk: (j) => K
kl: (k) => L
lm: (l) => M
mn: (m) => N
no: (n) => O
op: (o) => P
pq: (p) => Q
qr: (q) => R
rs: (r) => S
st: (s) => T
Returns: A
The result of applying all transformations.
Since
2.0.0
Performance
Inline execution for 0-5 functions (~2x faster), loop for 6+.
Also known as
chain (Radashi) · flow (Lodash, es-toolkit) · pipe (Remeda, Ramda, Effect) · ❌ (Modern Dash, Antfu)
Example
pipe(5, (x) => x * 2, (x) => x + 1);
// => 11
pipe(
'hello',
(s) => s.toUpperCase(),
(s) => s.split(''),
(arr) => arr.reverse(),
(arr) => arr.join('')
);
// => 'OLLEH'
How it works?
Composes functions left-to-right, passing each result to the next function.
Step-by-Step
String Transformation Example
pipe vs flowRight
| pipe | flowRight | |
|---|---|---|
| Direction | Left → Right | Right → Left |
| First arg | Initial value | Last function |
| Mental model | Data flows through | Math composition |
Use Cases
Function composition and chaining 📌
Compose multiple functions in a readable left-to-right manner. Essential for functional programming and clean data processing workflows.
const add = (n) => n + 1;
const double = (n) => n * 2;
const square = (n) => n * n;
const process = pipe(add, double, square);
// ((n + 1) * 2) ^ 2
process(2); // ((2+1)*2)^2 = 36
Data transformation pipelines
Transform data through multiple steps with type-safe function composition. Essential for complex data processing and ETL operations.
const cleanInput = pipe(
(s) => s.trim(),
(s) => s.toLowerCase(),
(s) => s.replace(/\s+/g, "-")
);
cleanInput(" Hello World "); // "hello-world"
Process API response through a full pipeline
Chain fetch, parse, normalize, and filter steps into a single readable pipeline. The real-world pattern developers write daily when consuming API data.
const getActiveUsers = pipe(
(response: Response) => response.json(),
(data: { users: User[] }) => data.users,
(users) => users.filter((u) => u.isActive),
(users) => users.map((u) => ({ id: u.id, name: u.name, email: u.email })),
);
const users = await fetch("/api/users").then(getActiveUsers);
// Raw response → parsed JSON → extracted array → filtered active → picked fields