The type of the objects in the input array.
The array of objects to group.
Optional
propertiesToInclude: (keyof T)[]A Result
object containing an array of objects representing the groups and their
items, or an error if the input is not valid.
Generated using TypeDoc v0.24.7
Groups an array of objects by a given property and returns an array of objects with a
group
key and an array of grouped objects as itsitems
value.Remarks
The resulting objects in the
items
array will only contain properties that are listed in theincludedProps
array. Ifdestruct
is set to true, the original objects in theitems
array will be destructed and only the filtered properties will remain.Example
Example usage, grouping by country and age, destruct name property