pipe function

Chain multiple async operations in sequence.

Example

const result = await pipe(
  user,
  [(u) => fetchRelations(u), (u) => enrichUser(u)]
);

Signature

pipe<T>(initial: T, operations: (value: T) => Promise<T>[]): Promise<T>

Type Parameters

T

Pipeline operation type

Parameters

initial

Initial value

operations

Array of async transformation functions

Returns

Promise resolving to the final value