API Reference

Takes a starting argument(s), runs it through a series of provided functions and provides the final result.

type GenericFunction<T> = (...args: T[]) => unknown

function pipe<FirstFn extends Func, F extends Func[]>(
  arg: Parameters<FirstFn>[number],
  firstFn: FirstFn,
  ...fns: PipeArgs<F> extends F ? F : PipeArgs<F>
)

// Example:

const double = (n: number) => n * 2
const add3 = (n: number) => n + 3

pipe(6, double, add3) //=> 15