Skip to content

Function: pipe() ​

Call Signature ​

pipe<A>(arg): A

Defined in: index.ts:161

Immediately applies (pipes) a value through a series of functions in order.

The pipe function is similar to flow, but instead of returning a composed function, it immediately executes the function chain with the provided initial value.

Type Parameters ​

A ​

A

The type of the initial value

Parameters ​

arg ​

A

The initial value to transform

Returns ​

A

The final transformed value

Examples ​

typescript
const result = pipe(
  5,
  (x) => x * 2,
  (x) => x + 1,
  (x) => x.toString()
); // "11"
typescript
const asyncResult = await pipe(
  5,
  (x) => x * 2,
  async (x) => Promise.resolve(x + 1),
  (x) => x.toString()
); // "11"

Call Signature ​

pipe<A, R1>(arg, f1): A extends Promise<unknown> ? Promise<Awaited<R1>> : R1 extends Promise<unknown> ? Promise<Awaited<R1>> : R1

Defined in: index.ts:162

Immediately applies (pipes) a value through a series of functions in order.

The pipe function is similar to flow, but instead of returning a composed function, it immediately executes the function chain with the provided initial value.

Type Parameters ​

A ​

A

The type of the initial value

R1 ​

R1

Parameters ​

arg ​

A

The initial value to transform

f1 ​

Fn<A, R1>

Returns ​

A extends Promise<unknown> ? Promise<Awaited<R1>> : R1 extends Promise<unknown> ? Promise<Awaited<R1>> : R1

The final transformed value

Examples ​

typescript
const result = pipe(
  5,
  (x) => x * 2,
  (x) => x + 1,
  (x) => x.toString()
); // "11"
typescript
const asyncResult = await pipe(
  5,
  (x) => x * 2,
  async (x) => Promise.resolve(x + 1),
  (x) => x.toString()
); // "11"

Call Signature ​

pipe<A, R1, R2>(arg, f1, f2): A extends Promise<unknown> ? Promise<Awaited<R2>> : R1 extends Promise<unknown> ? Promise<Awaited<R2>> : R2 extends Promise<unknown> ? Promise<Awaited<R2>> : R2

Defined in: index.ts:163

Immediately applies (pipes) a value through a series of functions in order.

The pipe function is similar to flow, but instead of returning a composed function, it immediately executes the function chain with the provided initial value.

Type Parameters ​

A ​

A

The type of the initial value

R1 ​

R1

R2 ​

R2

Parameters ​

arg ​

A

The initial value to transform

f1 ​

Fn<A, R1>

f2 ​

Fn<R1, R2>

Returns ​

A extends Promise<unknown> ? Promise<Awaited<R2>> : R1 extends Promise<unknown> ? Promise<Awaited<R2>> : R2 extends Promise<unknown> ? Promise<Awaited<R2>> : R2

The final transformed value

Examples ​

typescript
const result = pipe(
  5,
  (x) => x * 2,
  (x) => x + 1,
  (x) => x.toString()
); // "11"
typescript
const asyncResult = await pipe(
  5,
  (x) => x * 2,
  async (x) => Promise.resolve(x + 1),
  (x) => x.toString()
); // "11"

Call Signature ​

pipe<A, R1, R2, R3>(arg, f1, f2, f3): A extends Promise<unknown> ? Promise<Awaited<R3>> : R1 extends Promise<unknown> ? Promise<Awaited<R3>> : R2 extends Promise<unknown> ? Promise<Awaited<R3>> : R3 extends Promise<unknown> ? Promise<Awaited<R3>> : R3

Defined in: index.ts:164

Immediately applies (pipes) a value through a series of functions in order.

The pipe function is similar to flow, but instead of returning a composed function, it immediately executes the function chain with the provided initial value.

Type Parameters ​

A ​

A

The type of the initial value

R1 ​

R1

R2 ​

R2

R3 ​

R3

Parameters ​

arg ​

A

The initial value to transform

f1 ​

Fn<A, R1>

f2 ​

Fn<R1, R2>

f3 ​

Fn<R2, R3>

Returns ​

A extends Promise<unknown> ? Promise<Awaited<R3>> : R1 extends Promise<unknown> ? Promise<Awaited<R3>> : R2 extends Promise<unknown> ? Promise<Awaited<R3>> : R3 extends Promise<unknown> ? Promise<Awaited<R3>> : R3

The final transformed value

Examples ​

typescript
const result = pipe(
  5,
  (x) => x * 2,
  (x) => x + 1,
  (x) => x.toString()
); // "11"
typescript
const asyncResult = await pipe(
  5,
  (x) => x * 2,
  async (x) => Promise.resolve(x + 1),
  (x) => x.toString()
); // "11"

Call Signature ​

pipe<A, R1, R2, R3, R4>(arg, f1, f2, f3, f4): A extends Promise<unknown> ? Promise<Awaited<R4>> : R1 extends Promise<unknown> ? Promise<Awaited<R4>> : R2 extends Promise<unknown> ? Promise<Awaited<R4>> : R3 extends Promise<unknown> ? Promise<Awaited<R4>> : R4 extends Promise<unknown> ? Promise<Awaited<R4>> : R4

Defined in: index.ts:170

Immediately applies (pipes) a value through a series of functions in order.

The pipe function is similar to flow, but instead of returning a composed function, it immediately executes the function chain with the provided initial value.

Type Parameters ​

A ​

A

The type of the initial value

R1 ​

R1

R2 ​

R2

R3 ​

R3

R4 ​

R4

Parameters ​

arg ​

A

The initial value to transform

f1 ​

Fn<A, R1>

f2 ​

Fn<R1, R2>

f3 ​

Fn<R2, R3>

f4 ​

Fn<R3, R4>

Returns ​

A extends Promise<unknown> ? Promise<Awaited<R4>> : R1 extends Promise<unknown> ? Promise<Awaited<R4>> : R2 extends Promise<unknown> ? Promise<Awaited<R4>> : R3 extends Promise<unknown> ? Promise<Awaited<R4>> : R4 extends Promise<unknown> ? Promise<Awaited<R4>> : R4

The final transformed value

Examples ​

typescript
const result = pipe(
  5,
  (x) => x * 2,
  (x) => x + 1,
  (x) => x.toString()
); // "11"
typescript
const asyncResult = await pipe(
  5,
  (x) => x * 2,
  async (x) => Promise.resolve(x + 1),
  (x) => x.toString()
); // "11"

Call Signature ​

pipe<A, R1, R2, R3, R4, R5>(arg, f1, f2, f3, f4, f5): A extends Promise<unknown> ? Promise<Awaited<R5>> : R1 extends Promise<unknown> ? Promise<Awaited<R5>> : R2 extends Promise<unknown> ? Promise<Awaited<R5>> : R3 extends Promise<unknown> ? Promise<Awaited<R5>> : R4 extends Promise<unknown> ? Promise<Awaited<R5>> : R5 extends Promise<unknown> ? Promise<Awaited<R5>> : R5

Defined in: index.ts:177

Immediately applies (pipes) a value through a series of functions in order.

The pipe function is similar to flow, but instead of returning a composed function, it immediately executes the function chain with the provided initial value.

Type Parameters ​

A ​

A

The type of the initial value

R1 ​

R1

R2 ​

R2

R3 ​

R3

R4 ​

R4

R5 ​

R5

Parameters ​

arg ​

A

The initial value to transform

f1 ​

Fn<A, R1>

f2 ​

Fn<R1, R2>

f3 ​

Fn<R2, R3>

f4 ​

Fn<R3, R4>

f5 ​

Fn<R4, R5>

Returns ​

A extends Promise<unknown> ? Promise<Awaited<R5>> : R1 extends Promise<unknown> ? Promise<Awaited<R5>> : R2 extends Promise<unknown> ? Promise<Awaited<R5>> : R3 extends Promise<unknown> ? Promise<Awaited<R5>> : R4 extends Promise<unknown> ? Promise<Awaited<R5>> : R5 extends Promise<unknown> ? Promise<Awaited<R5>> : R5

The final transformed value

Examples ​

typescript
const result = pipe(
  5,
  (x) => x * 2,
  (x) => x + 1,
  (x) => x.toString()
); // "11"
typescript
const asyncResult = await pipe(
  5,
  (x) => x * 2,
  async (x) => Promise.resolve(x + 1),
  (x) => x.toString()
); // "11"

Call Signature ​

pipe<A, R1, R2, R3, R4, R5, R6>(arg, f1, f2, f3, f4, f5, f6): A extends Promise<unknown> ? Promise<Awaited<R6>> : R1 extends Promise<unknown> ? Promise<Awaited<R6>> : R2 extends Promise<unknown> ? Promise<Awaited<R6>> : R3 extends Promise<unknown> ? Promise<Awaited<R6>> : R4 extends Promise<unknown> ? Promise<Awaited<R6>> : R5 extends Promise<unknown> ? Promise<Awaited<R6>> : R6 extends Promise<unknown> ? Promise<Awaited<R6>> : R6

Defined in: index.ts:185

Immediately applies (pipes) a value through a series of functions in order.

The pipe function is similar to flow, but instead of returning a composed function, it immediately executes the function chain with the provided initial value.

Type Parameters ​

A ​

A

The type of the initial value

R1 ​

R1

R2 ​

R2

R3 ​

R3

R4 ​

R4

R5 ​

R5

R6 ​

R6

Parameters ​

arg ​

A

The initial value to transform

f1 ​

Fn<A, R1>

f2 ​

Fn<R1, R2>

f3 ​

Fn<R2, R3>

f4 ​

Fn<R3, R4>

f5 ​

Fn<R4, R5>

f6 ​

Fn<R5, R6>

Returns ​

A extends Promise<unknown> ? Promise<Awaited<R6>> : R1 extends Promise<unknown> ? Promise<Awaited<R6>> : R2 extends Promise<unknown> ? Promise<Awaited<R6>> : R3 extends Promise<unknown> ? Promise<Awaited<R6>> : R4 extends Promise<unknown> ? Promise<Awaited<R6>> : R5 extends Promise<unknown> ? Promise<Awaited<R6>> : R6 extends Promise<unknown> ? Promise<Awaited<R6>> : R6

The final transformed value

Examples ​

typescript
const result = pipe(
  5,
  (x) => x * 2,
  (x) => x + 1,
  (x) => x.toString()
); // "11"
typescript
const asyncResult = await pipe(
  5,
  (x) => x * 2,
  async (x) => Promise.resolve(x + 1),
  (x) => x.toString()
); // "11"

Call Signature ​

pipe<A, R1, R2, R3, R4, R5, R6, R7>(arg, f1, f2, f3, f4, f5, f6, f7): A extends Promise<unknown> ? Promise<Awaited<R7>> : R1 extends Promise<unknown> ? Promise<Awaited<R7>> : R2 extends Promise<unknown> ? Promise<Awaited<R7>> : R3 extends Promise<unknown> ? Promise<Awaited<R7>> : R4 extends Promise<unknown> ? Promise<Awaited<R7>> : R5 extends Promise<unknown> ? Promise<Awaited<R7>> : R6 extends Promise<unknown> ? Promise<Awaited<R7>> : R7 extends Promise<unknown> ? Promise<Awaited<R7>> : R7

Defined in: index.ts:194

Immediately applies (pipes) a value through a series of functions in order.

The pipe function is similar to flow, but instead of returning a composed function, it immediately executes the function chain with the provided initial value.

Type Parameters ​

A ​

A

The type of the initial value

R1 ​

R1

R2 ​

R2

R3 ​

R3

R4 ​

R4

R5 ​

R5

R6 ​

R6

R7 ​

R7

Parameters ​

arg ​

A

The initial value to transform

f1 ​

Fn<A, R1>

f2 ​

Fn<R1, R2>

f3 ​

Fn<R2, R3>

f4 ​

Fn<R3, R4>

f5 ​

Fn<R4, R5>

f6 ​

Fn<R5, R6>

f7 ​

Fn<R6, R7>

Returns ​

A extends Promise<unknown> ? Promise<Awaited<R7>> : R1 extends Promise<unknown> ? Promise<Awaited<R7>> : R2 extends Promise<unknown> ? Promise<Awaited<R7>> : R3 extends Promise<unknown> ? Promise<Awaited<R7>> : R4 extends Promise<unknown> ? Promise<Awaited<R7>> : R5 extends Promise<unknown> ? Promise<Awaited<R7>> : R6 extends Promise<unknown> ? Promise<Awaited<R7>> : R7 extends Promise<unknown> ? Promise<Awaited<R7>> : R7

The final transformed value

Examples ​

typescript
const result = pipe(
  5,
  (x) => x * 2,
  (x) => x + 1,
  (x) => x.toString()
); // "11"
typescript
const asyncResult = await pipe(
  5,
  (x) => x * 2,
  async (x) => Promise.resolve(x + 1),
  (x) => x.toString()
); // "11"

Call Signature ​

pipe<A, R1, R2, R3, R4, R5, R6, R7, R8>(arg, f1, f2, f3, f4, f5, f6, f7, f8): A extends Promise<unknown> ? Promise<Awaited<R8>> : R1 extends Promise<unknown> ? Promise<Awaited<R8>> : R2 extends Promise<unknown> ? Promise<Awaited<R8>> : R3 extends Promise<unknown> ? Promise<Awaited<R8>> : R4 extends Promise<unknown> ? Promise<Awaited<R8>> : R5 extends Promise<unknown> ? Promise<Awaited<R8>> : R6 extends Promise<unknown> ? Promise<Awaited<R8>> : R7 extends Promise<unknown> ? Promise<Awaited<R8>> : R8 extends Promise<unknown> ? Promise<Awaited<...>> : R8

Defined in: index.ts:204

Immediately applies (pipes) a value through a series of functions in order.

The pipe function is similar to flow, but instead of returning a composed function, it immediately executes the function chain with the provided initial value.

Type Parameters ​

A ​

A

The type of the initial value

R1 ​

R1

R2 ​

R2

R3 ​

R3

R4 ​

R4

R5 ​

R5

R6 ​

R6

R7 ​

R7

R8 ​

R8

Parameters ​

arg ​

A

The initial value to transform

f1 ​

Fn<A, R1>

f2 ​

Fn<R1, R2>

f3 ​

Fn<R2, R3>

f4 ​

Fn<R3, R4>

f5 ​

Fn<R4, R5>

f6 ​

Fn<R5, R6>

f7 ​

Fn<R6, R7>

f8 ​

Fn<R7, R8>

Returns ​

A extends Promise<unknown> ? Promise<Awaited<R8>> : R1 extends Promise<unknown> ? Promise<Awaited<R8>> : R2 extends Promise<unknown> ? Promise<Awaited<R8>> : R3 extends Promise<unknown> ? Promise<Awaited<R8>> : R4 extends Promise<unknown> ? Promise<Awaited<R8>> : R5 extends Promise<unknown> ? Promise<Awaited<R8>> : R6 extends Promise<unknown> ? Promise<Awaited<R8>> : R7 extends Promise<unknown> ? Promise<Awaited<R8>> : R8 extends Promise<unknown> ? Promise<Awaited<...>> : R8

The final transformed value

Examples ​

typescript
const result = pipe(
  5,
  (x) => x * 2,
  (x) => x + 1,
  (x) => x.toString()
); // "11"
typescript
const asyncResult = await pipe(
  5,
  (x) => x * 2,
  async (x) => Promise.resolve(x + 1),
  (x) => x.toString()
); // "11"

Call Signature ​

pipe<A, R1, R2, R3, R4, R5, R6, R7, R8, R9>(arg, f1, f2, f3, f4, f5, f6, f7, f8, f9): A extends Promise<unknown> ? Promise<Awaited<R9>> : R1 extends Promise<unknown> ? Promise<Awaited<R9>> : R2 extends Promise<unknown> ? Promise<Awaited<R9>> : R3 extends Promise<unknown> ? Promise<Awaited<R9>> : R4 extends Promise<unknown> ? Promise<Awaited<R9>> : R5 extends Promise<unknown> ? Promise<Awaited<R9>> : R6 extends Promise<unknown> ? Promise<Awaited<R9>> : R7 extends Promise<unknown> ? Promise<Awaited<R9>> : R8 extends Promise<unknown> ? Promise<Awaited<...>> : R9 extends Promise<...> ? Promise<...> : R9

Defined in: index.ts:215

Immediately applies (pipes) a value through a series of functions in order.

The pipe function is similar to flow, but instead of returning a composed function, it immediately executes the function chain with the provided initial value.

Type Parameters ​

A ​

A

The type of the initial value

R1 ​

R1

R2 ​

R2

R3 ​

R3

R4 ​

R4

R5 ​

R5

R6 ​

R6

R7 ​

R7

R8 ​

R8

R9 ​

R9

Parameters ​

arg ​

A

The initial value to transform

f1 ​

Fn<A, R1>

f2 ​

Fn<R1, R2>

f3 ​

Fn<R2, R3>

f4 ​

Fn<R3, R4>

f5 ​

Fn<R4, R5>

f6 ​

Fn<R5, R6>

f7 ​

Fn<R6, R7>

f8 ​

Fn<R7, R8>

f9 ​

Fn<R8, R9>

Returns ​

A extends Promise<unknown> ? Promise<Awaited<R9>> : R1 extends Promise<unknown> ? Promise<Awaited<R9>> : R2 extends Promise<unknown> ? Promise<Awaited<R9>> : R3 extends Promise<unknown> ? Promise<Awaited<R9>> : R4 extends Promise<unknown> ? Promise<Awaited<R9>> : R5 extends Promise<unknown> ? Promise<Awaited<R9>> : R6 extends Promise<unknown> ? Promise<Awaited<R9>> : R7 extends Promise<unknown> ? Promise<Awaited<R9>> : R8 extends Promise<unknown> ? Promise<Awaited<...>> : R9 extends Promise<...> ? Promise<...> : R9

The final transformed value

Examples ​

typescript
const result = pipe(
  5,
  (x) => x * 2,
  (x) => x + 1,
  (x) => x.toString()
); // "11"
typescript
const asyncResult = await pipe(
  5,
  (x) => x * 2,
  async (x) => Promise.resolve(x + 1),
  (x) => x.toString()
); // "11"

Call Signature ​

pipe<A, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10>(arg, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10): A extends Promise<unknown> ? Promise<Awaited<R10>> : R1 extends Promise<unknown> ? Promise<Awaited<R10>> : R2 extends Promise<unknown> ? Promise<Awaited<R10>> : R3 extends Promise<unknown> ? Promise<Awaited<R10>> : R4 extends Promise<unknown> ? Promise<Awaited<R10>> : R5 extends Promise<unknown> ? Promise<Awaited<R10>> : R6 extends Promise<unknown> ? Promise<Awaited<R10>> : R7 extends Promise<unknown> ? Promise<Awaited<R10>> : R8 extends Promise<unknown> ? Promise<Awaited<...>> : R9 extends Promise<...> ? Promise<...> : ... extends ... ? ... : ...

Defined in: index.ts:227

Immediately applies (pipes) a value through a series of functions in order.

The pipe function is similar to flow, but instead of returning a composed function, it immediately executes the function chain with the provided initial value.

Type Parameters ​

A ​

A

The type of the initial value

R1 ​

R1

R2 ​

R2

R3 ​

R3

R4 ​

R4

R5 ​

R5

R6 ​

R6

R7 ​

R7

R8 ​

R8

R9 ​

R9

R10 ​

R10

Parameters ​

arg ​

A

The initial value to transform

f1 ​

Fn<A, R1>

f2 ​

Fn<R1, R2>

f3 ​

Fn<R2, R3>

f4 ​

Fn<R3, R4>

f5 ​

Fn<R4, R5>

f6 ​

Fn<R5, R6>

f7 ​

Fn<R6, R7>

f8 ​

Fn<R7, R8>

f9 ​

Fn<R8, R9>

f10 ​

Fn<R9, R10>

Returns ​

A extends Promise<unknown> ? Promise<Awaited<R10>> : R1 extends Promise<unknown> ? Promise<Awaited<R10>> : R2 extends Promise<unknown> ? Promise<Awaited<R10>> : R3 extends Promise<unknown> ? Promise<Awaited<R10>> : R4 extends Promise<unknown> ? Promise<Awaited<R10>> : R5 extends Promise<unknown> ? Promise<Awaited<R10>> : R6 extends Promise<unknown> ? Promise<Awaited<R10>> : R7 extends Promise<unknown> ? Promise<Awaited<R10>> : R8 extends Promise<unknown> ? Promise<Awaited<...>> : R9 extends Promise<...> ? Promise<...> : ... extends ... ? ... : ...

The final transformed value

Examples ​

typescript
const result = pipe(
  5,
  (x) => x * 2,
  (x) => x + 1,
  (x) => x.toString()
); // "11"
typescript
const asyncResult = await pipe(
  5,
  (x) => x * 2,
  async (x) => Promise.resolve(x + 1),
  (x) => x.toString()
); // "11"

Call Signature ​

pipe<A>(arg, ...fns): unknown

Defined in: index.ts:240

Immediately applies (pipes) a value through a series of functions in order.

The pipe function is similar to flow, but instead of returning a composed function, it immediately executes the function chain with the provided initial value.

Type Parameters ​

A ​

A

The type of the initial value

Parameters ​

arg ​

A

The initial value to transform

fns ​

...Fn[]

A series of functions to apply in sequence, where each function's input type matches the previous function's output

Returns ​

unknown

The final transformed value

Examples ​

typescript
const result = pipe(
  5,
  (x) => x * 2,
  (x) => x + 1,
  (x) => x.toString()
); // "11"
typescript
const asyncResult = await pipe(
  5,
  (x) => x * 2,
  async (x) => Promise.resolve(x + 1),
  (x) => x.toString()
); // "11"