source: frontend/node_modules/underscore/modules/_group.js

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: 457 bytes
Line 
1import cb from './_cb.js';
2import each from './each.js';
3
4// An internal function used for aggregate "group by" operations.
5export default function group(behavior, partition) {
6 return function(obj, iteratee, context) {
7 var result = partition ? [[], []] : {};
8 iteratee = cb(iteratee, context);
9 each(obj, function(value, index) {
10 var key = iteratee(value, index, obj);
11 behavior(result, value, key);
12 });
13 return result;
14 };
15}
Note: See TracBrowser for help on using the repository browser.