Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/proc/tests/deps/asynciter.ts>AsyncIter

A high-level way to run child processes that is easy, flexible, powerful, and prevents resource leaks.
Go to Latest
class AsyncIter
implements IAsyncIter<T>
import { AsyncIter } from "https://deno.land/x/proc@0.20.5/tests/deps/asynciter.ts";

A decorator for AsyncIterable.

Constructors

new
AsyncIter(iterable: Iterable<T> | AsyncIterable<T> | Array<T>)

Constructor.

Properties

protected
iterator: AsyncIterable<T>

Methods

collect(): Promise<T[]>

Collect the items in this iterator to an array.

concurrentMap<U>(mapFn: (item: T) => Promise<U>, concurrency?: number): AsyncIter<U>

Map the sequence from one type to another, concurrently.

Results are returned in order.

concurrentUnorderedMap<U>(mapFn: (item: T) => Promise<U>, concurrency?: number): AsyncIter<U>

Map the sequence from one type to another, concurrently.

Items are iterated out of order. This allows maximum concurrency at all times, but the output order cannot be assumed to be the same as the input order.

filter(filterFn: (item: T) => boolean | Promise<boolean>): AsyncIter<T>

Filter the sequence to contain just the items that pass a test.

first(): Promise<T | null>

Return the first item of the sequence.

forEach(forEachFn: (item: T) => void | Promise<void>): Promise<void>

Perform an operation for each item in the sequence.

map<U>(mapFn: (item: T) => U | Promise<U>): AsyncIter<U>

Map the sequence from one type to another.

reduce<U>(zero: U, reduceFn: (acc: U, item: T) => U | Promise<U>): Promise<U>

Reduce a sequence to a single value.

[Symbol.asyncIterator](): AsyncGenerator<T, void, unknown>