flow source npm

_.flow([funcs])

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

Arguments

  1. [funcs] (...(Function|Function[])

    Functions to invoke.

Returns (Function)

Returns the new function.

Example

function square(n) {
  return n * n;
}

var addSquare = _.flow(_.add, square);
addSquare(1, 2);
// => 9