]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/vim-mode/node_modules/grim/node_modules/emissary/node_modules/es6-weak-map/node_modules/es5-ext/array/#/group.js
fbb178c35c173046eabe8bea01bbfb2e9bc387d1
1 // Inspired by Underscore's groupBy:
2 // http://documentcloud.github.com/underscore/#groupBy
6 var callable
= require('../../object/valid-callable')
7 , value
= require('../../object/valid-value')
9 , forEach
= Array
.prototype.forEach
, apply
= Function
.prototype.apply
;
11 module
.exports = function (cb
/*, thisArg*/) {
14 (value(this) && callable(cb
));
17 forEach
.call(this, function (v
) {
18 var key
= apply
.call(cb
, this, arguments
);
19 if (!r
.hasOwnProperty(key
)) r
[key
] = [];