Groups an array of items by a key returned by a mapping function.
const getLength = (item: string) => item.length;groupBy(getLength)(['a', 'bb', 'c', 'dd']); // => { '1': ['a', 'c'], '2': ['bb', 'dd'] } Copy
const getLength = (item: string) => item.length;groupBy(getLength)(['a', 'bb', 'c', 'dd']); // => { '1': ['a', 'c'], '2': ['bb', 'dd'] }
Groups an array of items by a key returned by a mapping function.
Example