|
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:
475 bytes
|
| Line | |
|---|
| 1 | var _cb = require('./_cb.js');
|
|---|
| 2 | var each = require('./each.js');
|
|---|
| 3 |
|
|---|
| 4 | // An internal function used for aggregate "group by" operations.
|
|---|
| 5 | 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 | }
|
|---|
| 16 |
|
|---|
| 17 | module.exports = group;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.