flowRight.js 590 B

123456789101112131415161718192021222324252627
  1. var createFlow = require('./_createFlow');
  2. /**
  3. * This method is like `_.flow` except that it creates a function that
  4. * invokes the given functions from right to left.
  5. *
  6. * @static
  7. * @since 3.0.0
  8. * @memberOf _
  9. * @category Util
  10. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  11. * @returns {Function} Returns the new composite function.
  12. * @see _.flow
  13. * @example
  14. *
  15. * function square(n) {
  16. * return n * n;
  17. * }
  18. *
  19. * var addSquare = _.flowRight([square, _.add]);
  20. * addSquare(1, 2);
  21. * // => 9
  22. */
  23. var flowRight = createFlow(true);
  24. module.exports = flowRight;