|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
777 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * A specialized version of `_.reduceRight` for arrays without support for
|
|---|
| 3 | * iteratee shorthands.
|
|---|
| 4 | *
|
|---|
| 5 | * @private
|
|---|
| 6 | * @param {Array} [array] The array to iterate over.
|
|---|
| 7 | * @param {Function} iteratee The function invoked per iteration.
|
|---|
| 8 | * @param {*} [accumulator] The initial value.
|
|---|
| 9 | * @param {boolean} [initAccum] Specify using the last element of `array` as
|
|---|
| 10 | * the initial value.
|
|---|
| 11 | * @returns {*} Returns the accumulated value.
|
|---|
| 12 | */
|
|---|
| 13 | function arrayReduceRight(array, iteratee, accumulator, initAccum) {
|
|---|
| 14 | var length = array == null ? 0 : array.length;
|
|---|
| 15 | if (initAccum && length) {
|
|---|
| 16 | accumulator = array[--length];
|
|---|
| 17 | }
|
|---|
| 18 | while (length--) {
|
|---|
| 19 | accumulator = iteratee(accumulator, array[length], length, array);
|
|---|
| 20 | }
|
|---|
| 21 | return accumulator;
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | module.exports = arrayReduceRight;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.