import { Lazy } from "https://deno.land/x/better_iterators@v1.2.1/mod.ts";
Constructors
new
private
Lazy(iter: Iterable<T>)Methods
associateBy<Key>(uniqueKeyFn: Transform<T, Key>): Map<Key, T>
Given uniqueKeyFn
, use it to extract a key from each item, and create a
1:1 map from that to each item.
associateBy<Key, Value>(uniqueKeyFn: Transform<T, Key>, valueFn: Transform<T, Value>): Map<Key, Value>
Takes an additional valueFn
to extract a value from T
. The returned
map maps from Key to Value. (instead of Key to T)
Get the first item. Returns defaultValue
if there is no first item.
Given keyFn
, use it to extract a key from each item, and create a Map
grouping items by that key.
Adds a valueFn
to extract that value (instead of T) into a group.
Apply transform
to each element.
Works like Array#map.
partition(f: Filter<T>): Partitioned<T>
Partition items into matches
and others
according to Filter f
.
[Symbol.iterator](): Iterator<T>