A group-by function working with the built-in Array.reduce()
npm install array-reduce-group-by
import {arrayReduceGroupBy} from "array-reduce-group-by";
["Alpha", "Beta", "Animal"]
.reduce(arrayReduceGroupBy((o) => o[0]), {});
//=> {A: ['Alpha', 'Animal'], B: ['Beta']}
Make sure not to forget the {}
in the end!
Type: (arrayElement) => string
Function to determine the key of a given array element