Files
lodash/flowRight.js
Luiz Américo 0e9d44eedb Fix flow and flowRight parameter handling (#4445)
* Enable flow and flowRight tests

* Remove flow and flowRight tests for default value and shortcut fusion

* Use native rest parameters / spread operator in flow and flowRight

* Fix syntax of flow and flowRight examples
2019-08-28 16:06:45 -07:00

29 lines
592 B
JavaScript

import flow from './flow.js'
/**
* This method is like `flow` except that it composes a function that
* invokes the given functions from right to left.
*
* @since 3.0.0
* @category Util
* @param {Function[]} [funcs] The functions to invoke.
* @returns {Function} Returns the new composite function.
* @see flow
* @example
*
* import add from 'lodash/add'
*
* function square(n) {
* return n * n
* }
*
* const addSquare = flowRight(square, add)
* addSquare(1, 2)
* // => 9
*/
function flowRight(...funcs) {
return flow(...funcs.reverse())
}
export default flowRight