@seasketch/geoprocessing
Version:
Geoprocessing and reporting framework for SeaSketch 2.0
9 lines • 361 B
JavaScript
/** Similar to lodash groupBy */
export const groupBy = (list, getKey) => list.reduce((previous, currentItem) => {
const group = getKey(currentItem);
if (!previous[group]) {
return { ...previous, [group]: [currentItem] };
}
return { ...previous, [group]: previous[group].concat(currentItem) };
}, {});
//# sourceMappingURL=groupBy.js.map