Tweakr
    Preparing search index...

    Function pipe

    • Composes multiple functions from left to right (a.k.a. pipeline).

      The output of each function is passed as input to the next function.

      Parameters

      • ...fns: Function[]

        Functions to pipe, applied from left to right.

      Returns (x: any) => any

      A function that represents the pipelined composition.

      const add = (x: number) => x + 1;
      const double = (x: number) => x * 2;
      const piped = pipe(add, double);
      console.log(piped(3)); // (3 + 1) * 2 = 8

      1.1.0