UseGroupBy
katanakit-js / useGroupBy
Function: useGroupBy()
Section titled “Function: useGroupBy()”function useGroupBy<T>(array, key): Record<string, T[]>;Defined in: core/services/utils.service.ts:446
Groups array items by a key property or key selector function.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
array |
T[] |
key |
keyof T | ((item) => string) |
Returns
Section titled “Returns”Record<string, T[]>
Example
Section titled “Example”useGroupBy(items, "type");