Maps an array of objects by a specified property, creating a map where the key is
the value of the specified property and the value is an array of objects that have
the same property value.
Returns
A map where the keys are the unique property values and the values are arrays of objects that share that property value.
Type Parameters
V
K = string
Parameters
objects: V[]
The array of objects to be mapped.
prop: keyof V
The property name by which the objects will be mapped.
Maps an array of objects by a specified property, creating a map where the key is the value of the specified property and the value is an array of objects that have the same property value.
Returns
A map where the keys are the unique property values and the values are arrays of objects that share that property value.