core3-utils

@wixc3/common on Github

Home > @wixc3/common > groupBy

groupBy() function

Groups elements by the value of a property

Signature:

export declare function groupBy<T, K extends keyof T>(elements: Iterable<T>, property: K): Map<T[K], T[]>;

Parameters

Parameter Type Description
elements Iterable<T>
property K

Returns:

Map<T[K], T[]>

A map of the value to an array of elements