|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
924 bytes
|
| Rev | Line | |
|---|
| [9af201e] | 1 | var arrayEachRight = require('./_arrayEachRight'),
|
|---|
| 2 | baseEachRight = require('./_baseEachRight'),
|
|---|
| 3 | castFunction = require('./_castFunction'),
|
|---|
| 4 | isArray = require('./isArray');
|
|---|
| 5 |
|
|---|
| 6 | /**
|
|---|
| 7 | * This method is like `_.forEach` except that it iterates over elements of
|
|---|
| 8 | * `collection` from right to left.
|
|---|
| 9 | *
|
|---|
| 10 | * @static
|
|---|
| 11 | * @memberOf _
|
|---|
| 12 | * @since 2.0.0
|
|---|
| 13 | * @alias eachRight
|
|---|
| 14 | * @category Collection
|
|---|
| 15 | * @param {Array|Object} collection The collection to iterate over.
|
|---|
| 16 | * @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
|---|
| 17 | * @returns {Array|Object} Returns `collection`.
|
|---|
| 18 | * @see _.forEach
|
|---|
| 19 | * @example
|
|---|
| 20 | *
|
|---|
| 21 | * _.forEachRight([1, 2], function(value) {
|
|---|
| 22 | * console.log(value);
|
|---|
| 23 | * });
|
|---|
| 24 | * // => Logs `2` then `1`.
|
|---|
| 25 | */
|
|---|
| 26 | function forEachRight(collection, iteratee) {
|
|---|
| 27 | var func = isArray(collection) ? arrayEachRight : baseEachRight;
|
|---|
| 28 | return func(collection, castFunction(iteratee));
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | module.exports = forEachRight;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.