Skip to Content

groupBy()

Groups objects into arrays keyed by the value of a specified property.

Kind: global function
Returns: Object - An object where each key is a distinct property value and each value is an array of matching objects.

ParamTypeDescription
objectsArray.<Object>The array to group.
groupByPropertystringThe property whose value becomes the group key.

Example

const byKind = ARM.groupBy(addresses, 'attributes.kind') // { home: [...], office: [...] }
Last updated on