| 5885 | |
| 5886 | // An internal function used for aggregate "group by" operations. |
| 5887 | var group = function(obj, value, context, behavior) { |
| 5888 | var result = {}; |
| 5889 | var iterator = lookupIterator(value || _.identity); |
| 5890 | each(obj, function(value, index) { |
| 5891 | var key = iterator.call(context, value, index, obj); |
| 5892 | behavior(result, key, value); |
| 5893 | }); |
| 5894 | return result; |
| 5895 | }; |
| 5896 | |
| 5897 | // Groups the object's values by a criterion. Pass either a string attribute |
| 5898 | // to group by, or a function that returns the criterion. |