import { LazyAsync } from "https://deno.land/x/better_iterators@v1.5.0/mod.ts";
Constructors
new
private
LazyAsync(iter: AsyncIterable<T>)Methods
associateBy<Key>(uniqueKeyFn: Transform<T, Key>): Promise<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>): Promise<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)
Iterate by chunks of a given size formed from the underlying Iterator.
Each chunk will be exactly size
until the last chunk, which may be
from 1-size items long.
groupBy<Key, Value>(keyFn: Transform<T, Key>, valueFn: Transform<T, Value>): Promise<Map<Key, Value[]>>
Adds a valueFn
to extract that value (instead of T) into a group.
joinToString(args?: JoinToStringArgs): Promise<JoinedToString<T>>
Joins multiple string values into a string.
map<Out>(options: ParallelMapOptions<T, Out>): LazyAsync<Out>
deprecated
mapParUnordered<Out>(max: number, transform: Transform<T, Promise<Out>>): LazyAsync<Out>partition(f: Filter<T>): Promise<Partitioned<T>>
Partition items into matches
and others
according to Filter f
.
peekable(): PeekableAsync<T>
Get a "peekable" iterator, which lets you peek() at the next item without removing it from the iterator.
Repeat items count
times.
import { range } from "./mod.ts"
let nine = range({to: 3}).repeat(3).sum()
[Symbol.asyncIterator](): AsyncIterator<T>