Skip to main content
Module

x/better_iterators/mod.ts>Lazy#groupBy

Chainable iterators (sync and async) for TypeScript, with support for opt-in, bounded parallelism
Go to Latest
method Lazy.prototype.groupBy
import { Lazy } from "https://deno.land/x/better_iterators@v1.2.1/mod.ts";

Given keyFn, use it to extract a key from each item, and create a Map grouping items by that key.

Returns

Map<Key, T[]>

Adds a valueFn to extract that value (instead of T) into a group.

Parameters

keyFn: Transform<T, Key>
valueFn: Transform<T, Value>