mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 07:17:50 +00:00
27 lines
557 B
JavaScript
27 lines
557 B
JavaScript
import flow from './flow.js';
|
|
|
|
/**
|
|
* This method is like `flow` except that it creates 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
|
|
*
|
|
* 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;
|