1 var arrayEachRight = require('./_arrayEachRight'),
2 baseEachRight = require('./_baseEachRight'),
3 isArray = require('./isArray'),
4 toFunction = require('./_toFunction');
7 * This method is like `_.forEach` except that it iterates over elements of
8 * `collection` from right to left.
13 * @category Collection
14 * @param {Array|Object} collection The collection to iterate over.
15 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
16 * @returns {Array|Object} Returns `collection`.
19 * _.forEachRight([1, 2], function(value) {
22 * // => logs `2` then `1`
24 function forEachRight(collection, iteratee) {
25 return (typeof iteratee == 'function' && isArray(collection))
26 ? arrayEachRight(collection, iteratee)
27 : baseEachRight(collection, toFunction(iteratee));
30 module.exports = forEachRight;