Function pipe

  • Starting with the initial input, performs a series of transforms, passing the return value of each function as the argument to the next.

    Remarks

    The implementation contains types to support up to twelve transformations. All overload signatures follow the same pattern as the representative form shown here.

    Example

    import { pipe } from "flurp";
    import * as N from "flurp/number";

    pipe(
    3,
    N.multiply(2), // 6 so far
    N.add(4.2), // 10.2 so far
    Math.round
    ); // 10

    Type Parameters

    • A

    • B

    • C

    Parameters

    • initial: A
    • f1: ((x: A) => B)
        • (x: A): B
        • Parameters

          • x: A

          Returns B

    • f2: ((x: B) => C)
        • (x: B): C
        • Parameters

          • x: B

          Returns C

    Returns C