@serenity-is/corelib / groupBy
Function: groupBy()
groupBy<
TItem>(items,getKey):GroupByResult<TItem>
Groups an array with keys determined by specified getKey() callback. Resulting object contains group objects in order and a dictionary to access by key. This is similar to LINQ's ToLookup function with some additional details like start index.
Type Parameters
• TItem
Parameters
items
TItem[]
Array to group.
getKey
(x) => any
Function that returns key for each item.
Returns
GroupByResult<TItem>
GroupByResult object.