source: trip-planner-front/node_modules/lodash/_createAggregator.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 789 bytes
Line 
1var arrayAggregator = require('./_arrayAggregator'),
2 baseAggregator = require('./_baseAggregator'),
3 baseIteratee = require('./_baseIteratee'),
4 isArray = require('./isArray');
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
23module.exports = createAggregator;
Note: See TracBrowser for help on using the repository browser.