forEachRight.js 892 B

1234567891011121314151617181920212223242526
  1. var arrayEachRight = require('../internal/arrayEachRight'),
  2. baseEachRight = require('../internal/baseEachRight'),
  3. createForEach = require('../internal/createForEach');
  4. /**
  5. * This method is like `_.forEach` except that it iterates over elements of
  6. * `collection` from right to left.
  7. *
  8. * @static
  9. * @memberOf _
  10. * @alias eachRight
  11. * @category Collection
  12. * @param {Array|Object|string} collection The collection to iterate over.
  13. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  14. * @param {*} [thisArg] The `this` binding of `iteratee`.
  15. * @returns {Array|Object|string} Returns `collection`.
  16. * @example
  17. *
  18. * _([1, 2]).forEachRight(function(n) {
  19. * console.log(n);
  20. * }).value();
  21. * // => logs each value from right to left and returns the array
  22. */
  23. var forEachRight = createForEach(arrayEachRight, baseEachRight);
  24. module.exports = forEachRight;