groupBy (Functional Programming) es-toolkit
Creates a function that groups values by a key. Use it with pipe.
Info
Usage
groupBy calls getKey for each value in the piped array and returns an object whose keys are the returned keys and whose values are arrays of matching items.
Parameters
getKey(item: T) => Krequired
The function that returns the group key for each value.
Returns
A function that maps a readonly T[] to grouped arrays by key.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.