MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / group

Function group

public/javascripts/underscore.js:394–404  ·  view source on GitHub ↗
(behavior)

Source from the content-addressed store, hash-verified

392
393 // An internal function used for aggregate "group by" operations.
394 var group = function(behavior) {
395 return function(obj, iteratee, context) {
396 var result = {};
397 iteratee = cb(iteratee, context);
398 _.each(obj, function(value, index) {
399 var key = iteratee(value, index, obj);
400 behavior(result, value, key);
401 });
402 return result;
403 };
404 };
405
406 // Groups the object's values by a criterion. Pass either a string attribute
407 // to group by, or a function that returns the criterion.

Callers 1

underscore.jsFile · 0.70

Calls 2

iterateeFunction · 0.85
cbFunction · 0.70

Tested by

no test coverage detected