Function flow

  • Composes a function that returns the result of invoking the given functions with the this binding of the created function, where each successive invocation is supplied the return value of the previous.

    Parameters

    • Rest...funcs: Function[]

      The functions to invoke.

    Returns Function

    Returns the new composite function.

    5.18.0

    flowRight

    function square(n) {
    return n * n
    }

    const addSquare = flow(add, square)
    addSquare(1, 2)
    // => 9