Basic usage

Given an array of items, group will build up an object where each key is an array of the items that belong in that group. Generally, this can be useful to categorize an array.

import { group } from 'radash'

const fish = [{
  name: 'Marlin',
  source: 'ocean'
}, {
  name: 'Bass',
  source: 'lake'
}, {
  name: 'Trout',
  source: 'lake'
}]

const fishBySource = group(fish, f => f.source) // => { ocean: [marlin], lake: [bass, trout] }

Testing

This _.group function is 100% covered by tests. See them and contribute at GitHub.

Source

See the source for _.group on GitHub.