Library API
    Preparing search index...

    Function flow

    • Composes functions left-to-right into a reusable pipeline function. The first stage may accept multiple arguments and an explicit this receiver; subsequent stages are unary.

      Type Parameters

      • This
      • Args extends readonly any[]
      • B

      Parameters

      • fn1: (this: This, ...args: Args) => B

        Initial function accepting the composed call arguments

      Returns (this: This, ...args: Args) => B

      A composed function executing the pipeline left-to-right

      const addAndDouble = flow((a: number, b: number) => a + b, n => n * 2);
      addAndDouble(2, 3); // 10
    • Composes functions left-to-right into a reusable pipeline function. The first stage may accept multiple arguments and an explicit this receiver; subsequent stages are unary.

      Type Parameters

      • This
      • Args extends readonly any[]
      • B
      • C

      Parameters

      • fn1: (this: This, ...args: Args) => B

        Initial function accepting the composed call arguments

      • fn2: Unary<B, C>

      Returns (this: This, ...args: Args) => C

      A composed function executing the pipeline left-to-right

      const addAndDouble = flow((a: number, b: number) => a + b, n => n * 2);
      addAndDouble(2, 3); // 10
    • Composes functions left-to-right into a reusable pipeline function. The first stage may accept multiple arguments and an explicit this receiver; subsequent stages are unary.

      Type Parameters

      • This
      • Args extends readonly any[]
      • B
      • C
      • D

      Parameters

      • fn1: (this: This, ...args: Args) => B

        Initial function accepting the composed call arguments

      • fn2: Unary<B, C>
      • fn3: Unary<C, D>

      Returns (this: This, ...args: Args) => D

      A composed function executing the pipeline left-to-right

      const addAndDouble = flow((a: number, b: number) => a + b, n => n * 2);
      addAndDouble(2, 3); // 10
    • Composes functions left-to-right into a reusable pipeline function. The first stage may accept multiple arguments and an explicit this receiver; subsequent stages are unary.

      Type Parameters

      • This
      • Args extends readonly any[]
      • B
      • C
      • D
      • E

      Parameters

      • fn1: (this: This, ...args: Args) => B

        Initial function accepting the composed call arguments

      • fn2: Unary<B, C>
      • fn3: Unary<C, D>
      • fn4: Unary<D, E>

      Returns (this: This, ...args: Args) => E

      A composed function executing the pipeline left-to-right

      const addAndDouble = flow((a: number, b: number) => a + b, n => n * 2);
      addAndDouble(2, 3); // 10
    • Composes functions left-to-right into a reusable pipeline function. The first stage may accept multiple arguments and an explicit this receiver; subsequent stages are unary.

      Type Parameters

      • This
      • Args extends readonly any[]
      • B
      • C
      • D
      • E
      • F

      Parameters

      • fn1: (this: This, ...args: Args) => B

        Initial function accepting the composed call arguments

      • fn2: Unary<B, C>
      • fn3: Unary<C, D>
      • fn4: Unary<D, E>
      • fn5: Unary<E, F>

      Returns (this: This, ...args: Args) => F

      A composed function executing the pipeline left-to-right

      const addAndDouble = flow((a: number, b: number) => a + b, n => n * 2);
      addAndDouble(2, 3); // 10
    • Composes functions left-to-right into a reusable pipeline function. The first stage may accept multiple arguments and an explicit this receiver; subsequent stages are unary.

      Type Parameters

      • This
      • Args extends readonly any[]
      • B
      • C
      • D
      • E
      • F
      • G

      Parameters

      • fn1: (this: This, ...args: Args) => B

        Initial function accepting the composed call arguments

      • fn2: Unary<B, C>
      • fn3: Unary<C, D>
      • fn4: Unary<D, E>
      • fn5: Unary<E, F>
      • fn6: Unary<F, G>

      Returns (this: This, ...args: Args) => G

      A composed function executing the pipeline left-to-right

      const addAndDouble = flow((a: number, b: number) => a + b, n => n * 2);
      addAndDouble(2, 3); // 10
    • Composes functions left-to-right into a reusable pipeline function. The first stage may accept multiple arguments and an explicit this receiver; subsequent stages are unary.

      Type Parameters

      • This
      • Args extends readonly any[]
      • B
      • C
      • D
      • E
      • F
      • G
      • H

      Parameters

      • fn1: (this: This, ...args: Args) => B

        Initial function accepting the composed call arguments

      • fn2: Unary<B, C>
      • fn3: Unary<C, D>
      • fn4: Unary<D, E>
      • fn5: Unary<E, F>
      • fn6: Unary<F, G>
      • fn7: Unary<G, H>

      Returns (this: This, ...args: Args) => H

      A composed function executing the pipeline left-to-right

      const addAndDouble = flow((a: number, b: number) => a + b, n => n * 2);
      addAndDouble(2, 3); // 10
    • Composes functions left-to-right into a reusable pipeline function. The first stage may accept multiple arguments and an explicit this receiver; subsequent stages are unary.

      Type Parameters

      • This
      • Args extends readonly any[]
      • B
      • C
      • D
      • E
      • F
      • G
      • H
      • I

      Parameters

      • fn1: (this: This, ...args: Args) => B

        Initial function accepting the composed call arguments

      • fn2: Unary<B, C>
      • fn3: Unary<C, D>
      • fn4: Unary<D, E>
      • fn5: Unary<E, F>
      • fn6: Unary<F, G>
      • fn7: Unary<G, H>
      • fn8: Unary<H, I>

      Returns (this: This, ...args: Args) => I

      A composed function executing the pipeline left-to-right

      const addAndDouble = flow((a: number, b: number) => a + b, n => n * 2);
      addAndDouble(2, 3); // 10
    • Composes functions left-to-right into a reusable pipeline function. The first stage may accept multiple arguments and an explicit this receiver; subsequent stages are unary.

      Type Parameters

      • This
      • Args extends readonly any[]
      • B
      • C
      • D
      • E
      • F
      • G
      • H
      • I
      • J

      Parameters

      • fn1: (this: This, ...args: Args) => B

        Initial function accepting the composed call arguments

      • fn2: Unary<B, C>
      • fn3: Unary<C, D>
      • fn4: Unary<D, E>
      • fn5: Unary<E, F>
      • fn6: Unary<F, G>
      • fn7: Unary<G, H>
      • fn8: Unary<H, I>
      • fn9: Unary<I, J>

      Returns (this: This, ...args: Args) => J

      A composed function executing the pipeline left-to-right

      const addAndDouble = flow((a: number, b: number) => a + b, n => n * 2);
      addAndDouble(2, 3); // 10
    • Composes functions left-to-right into a reusable pipeline function. The first stage may accept multiple arguments and an explicit this receiver; subsequent stages are unary.

      Type Parameters

      • This
      • Args extends readonly any[]
      • B
      • C
      • D
      • E
      • F
      • G
      • H
      • I
      • J
      • K

      Parameters

      • fn1: (this: This, ...args: Args) => B

        Initial function accepting the composed call arguments

      • fn2: Unary<B, C>
      • fn3: Unary<C, D>
      • fn4: Unary<D, E>
      • fn5: Unary<E, F>
      • fn6: Unary<F, G>
      • fn7: Unary<G, H>
      • fn8: Unary<H, I>
      • fn9: Unary<I, J>
      • fn10: Unary<J, K>

      Returns (this: This, ...args: Args) => K

      A composed function executing the pipeline left-to-right

      const addAndDouble = flow((a: number, b: number) => a + b, n => n * 2);
      addAndDouble(2, 3); // 10