Function flow

  • Performs a series of function calls on a value, passing the result of each function call to the next.

    Type Parameters

    • A
    • R

    Parameters

    • a: A
    • fn1: (x: A) => R

    Returns R

    const add = (a: number, b: number) => a + b;
    const byTwo = (x: number) => x * 2;
    const result = flow(1, add, byTwo);
  • Performs a series of function calls on a value, passing the result of each function call to the next.

    Type Parameters

    • A
    • B
    • R

    Parameters

    • a: A
    • fn1: (x: A) => B
    • fn2: (x: B) => R

    Returns R

    const add = (a: number, b: number) => a + b;
    const byTwo = (x: number) => x * 2;
    const result = flow(1, add, byTwo);
  • Performs a series of function calls on a value, passing the result of each function call to the next.

    Type Parameters

    • A
    • B
    • C
    • R

    Parameters

    • a: A
    • fn1: (x: A) => B
    • fn2: (x: B) => C
    • fn3: (x: C) => R

    Returns R

    const add = (a: number, b: number) => a + b;
    const byTwo = (x: number) => x * 2;
    const result = flow(1, add, byTwo);
  • Performs a series of function calls on a value, passing the result of each function call to the next.

    Type Parameters

    • A
    • B
    • C
    • D
    • R

    Parameters

    • a: A
    • fn1: (x: A) => B
    • fn2: (x: B) => C
    • fn3: (x: C) => D
    • fn4: (x: D) => R

    Returns R

    const add = (a: number, b: number) => a + b;
    const byTwo = (x: number) => x * 2;
    const result = flow(1, add, byTwo);
  • Performs a series of function calls on a value, passing the result of each function call to the next.

    Type Parameters

    • A
    • B
    • C
    • D
    • E
    • R

    Parameters

    • a: A
    • fn1: (x: A) => B
    • fn2: (x: B) => C
    • fn3: (x: C) => D
    • fn4: (x: D) => E
    • fn5: (x: E) => R

    Returns R

    const add = (a: number, b: number) => a + b;
    const byTwo = (x: number) => x * 2;
    const result = flow(1, add, byTwo);
  • Performs a series of function calls on a value, passing the result of each function call to the next.

    Type Parameters

    • A
    • B
    • C
    • D
    • E
    • F
    • R

    Parameters

    • a: A
    • fn1: (x: A) => B
    • fn2: (x: B) => C
    • fn3: (x: C) => D
    • fn4: (x: D) => E
    • fn5: (x: E) => F
    • fn6: (x: F) => R

    Returns R

    const add = (a: number, b: number) => a + b;
    const byTwo = (x: number) => x * 2;
    const result = flow(1, add, byTwo);
  • Performs a series of function calls on a value, passing the result of each function call to the next.

    Type Parameters

    • A
    • B
    • C
    • D
    • E
    • F
    • G
    • R

    Parameters

    • a: A
    • fn1: (x: A) => B
    • fn2: (x: B) => C
    • fn3: (x: C) => D
    • fn4: (x: D) => E
    • fn5: (x: E) => F
    • fn6: (x: F) => G
    • fn7: (x: G) => R

    Returns R

    const add = (a: number, b: number) => a + b;
    const byTwo = (x: number) => x * 2;
    const result = flow(1, add, byTwo);
  • Performs a series of function calls on a value, passing the result of each function call to the next.

    Type Parameters

    • A
    • B
    • C
    • D
    • E
    • F
    • G
    • H
    • R

    Parameters

    • a: A
    • fn1: (x: A) => B
    • fn2: (x: B) => C
    • fn3: (x: C) => D
    • fn4: (x: D) => E
    • fn5: (x: E) => F
    • fn6: (x: F) => G
    • fn7: (x: G) => H
    • fn8: (x: H) => R

    Returns R

    const add = (a: number, b: number) => a + b;
    const byTwo = (x: number) => x * 2;
    const result = flow(1, add, byTwo);
  • Performs a series of function calls on a value, passing the result of each function call to the next.

    Type Parameters

    • A
    • B
    • C
    • D
    • E
    • F
    • G
    • H
    • I
    • R

    Parameters

    • a: A
    • fn1: (x: A) => B
    • fn2: (x: B) => C
    • fn3: (x: C) => D
    • fn4: (x: D) => E
    • fn5: (x: E) => F
    • fn6: (x: F) => G
    • fn7: (x: G) => H
    • fn8: (x: H) => I
    • fn9: (x: I) => R

    Returns R

    const add = (a: number, b: number) => a + b;
    const byTwo = (x: number) => x * 2;
    const result = flow(1, add, byTwo);