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