Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

just-group-by

angus-c67.3kMIT2.2.0TypeScript support: included

return a grouped object from array

array, groupby, no-dependencies, just

readme

just-group-by

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

npm install just-group-by
yarn add just-group-by

Return a grouped object from array

import groupBy from 'just-group-by';

groupBy([6.1, 4.2, 6.3], Math.floor); // { '4': [4.2], '6': [6.1, 6.3] }
groupBy([1,2,3,4,5,6,7,8], function(i) { return i % 2}); // { '0': [2, 4, 6, 8], '1': [1, 3, 5, 7] }

changelog

just-group-by

2.2.0

Minor Changes

  • Rename node module .js -> .cjs

2.1.2

Patch Changes

  • Type improvements

2.1.1

Patch Changes

  • fix: reorder exports to set default last #488

2.1.0

Minor Changes

  • package.json updates to fix #467 and #483

2.0.2

Patch Changes

  • Improved TS definition