Package Exports
- grouper
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (grouper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Grouper.js

Group objects by their properties.
Usage
Given an array of objects:
var arr = [
{ name: 'foo', age: 2, score: 0 },
{ name: 'bar', age: 2, score: 0 },
{ name: 'baz', age: 3, score: 0 },
{ name: 'qux', age: 2, score: 1 }
];…we can group the objects by a single property:
grouper(arr, 'age');
/* =>
* [ [ { name: 'foo', age: 2, score: 0 },
* { name: 'bar', age: 2, score: 0 },
* { name: 'qux', age: 2, score: 1 } ],
* [ { name: 'baz', age: 3, score: 0 } ] ]
*/…or by multiple properties:
grouper(arr, ['age', 'score']);
/* =>
* [ [ { name: 'foo', age: 2, score: 0 },
* { name: 'bar', age: 2, score: 0 } ],
* [ { name: 'baz', age: 3, score: 0 } ],
* [ { name: 'qux', age: 2, score: 1 } ] ]
*/API
grouper(arr, props)
props may be an array or a string. Objects to be grouped together must have the same value (strict ===) for every property in props.
Installation
Install using npm:
$ npm i --save grouperOr grab the minified script from the dist directory.