Skip to main content
Module

x/better_iterators/mod.ts>Lazy#associateBy

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

Given uniqueKeyFn, use it to extract a key from each item, and create a 1:1 map from that to each item.

Parameters

uniqueKeyFn: Transform<T, Key>

Returns

Map<Key, T>

Takes an additional valueFn to extract a value from T. The returned map maps from Key to Value. (instead of Key to T)

Parameters

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