source: imaps-frontend/node_modules/lodash-es/_createAggregator.js@ d565449

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: 787 bytes
RevLine 
[d565449]1import arrayAggregator from './_arrayAggregator.js';
2import baseAggregator from './_baseAggregator.js';
3import baseIteratee from './_baseIteratee.js';
4import isArray from './isArray.js';
5
6/**
7 * Creates a function like `_.groupBy`.
8 *
9 * @private
10 * @param {Function} setter The function to set accumulator values.
11 * @param {Function} [initializer] The accumulator object initializer.
12 * @returns {Function} Returns the new aggregator function.
13 */
14function createAggregator(setter, initializer) {
15 return function(collection, iteratee) {
16 var func = isArray(collection) ? arrayAggregator : baseAggregator,
17 accumulator = initializer ? initializer() : {};
18
19 return func(collection, setter, baseIteratee(iteratee, 2), accumulator);
20 };
21}
22
23export default createAggregator;
Note: See TracBrowser for help on using the repository browser.