(behavior)
| 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. |
no test coverage detected