You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
315 B
12 lines
315 B
|
4 months ago
|
export function group(array, keyFunc) {
|
||
|
|
var grouped = new Map();
|
||
|
|
array.forEach(function (item) {
|
||
|
|
var key = keyFunc(item);
|
||
|
|
if (!grouped.has(key)) {
|
||
|
|
grouped.set(key, []);
|
||
|
|
}
|
||
|
|
grouped.get(key).push(item);
|
||
|
|
});
|
||
|
|
return grouped;
|
||
|
|
}
|
||
|
|
//# sourceMappingURL=group.js.map
|