type groupBy
Returns an AsyncReducer
that uses the valueToKey
function to calculate a key for each value, and feeds the tuple of the key and the value to the collector
reducer. Finally, it returns the output of the collector
. If no collector is given, the default collector will return a JS multimap of the type Map<K, V[]>
.
Definition
groupBy: {
<T, K, R, T2 extends readonly [K, T] = [K, T]>(valueToKey: (value: T, index: number) =>
MaybePromise
<K>, options: {
collector:
AsyncReducer.Accept
<[K, T]
|
T2, R>;
}):
AsyncReducer
<T, R>;
<T, K>(valueToKey: (value: T, index: number) =>
MaybePromise
<K>, options?: {
collector?: undefined;
}):
AsyncReducer
<T, Map<K, T[]>>;
}