main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
682 bytes
|
Line | |
---|
1 | /**
|
---|
2 | * A specialized version of `baseAggregator` for arrays.
|
---|
3 | *
|
---|
4 | * @private
|
---|
5 | * @param {Array} [array] The array to iterate over.
|
---|
6 | * @param {Function} setter The function to set `accumulator` values.
|
---|
7 | * @param {Function} iteratee The iteratee to transform keys.
|
---|
8 | * @param {Object} accumulator The initial aggregated object.
|
---|
9 | * @returns {Function} Returns `accumulator`.
|
---|
10 | */
|
---|
11 | function arrayAggregator(array, setter, iteratee, accumulator) {
|
---|
12 | var index = -1,
|
---|
13 | length = array == null ? 0 : array.length;
|
---|
14 |
|
---|
15 | while (++index < length) {
|
---|
16 | var value = array[index];
|
---|
17 | setter(accumulator, value, iteratee(value), array);
|
---|
18 | }
|
---|
19 | return accumulator;
|
---|
20 | }
|
---|
21 |
|
---|
22 | export default arrayAggregator;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.