UNPKG

typedash

Version:

modern, type-safe collection of utility functions

16 lines (15 loc) 391 B
// src/functions/groupBy/groupBy.ts function groupBy(array, getter) { return (array ?? []).reduce( (draftGroups, currentItem) => { const key = getter(currentItem); draftGroups[key] ??= []; draftGroups[key].push(currentItem); return draftGroups; }, {} ); } export { groupBy }; //# sourceMappingURL=out.js.map //# sourceMappingURL=chunk-UDIMK2OR.js.map