Function async

  • Maps the given input iterable to an equivalent asynchronous iterable.

    Returns

    A function that accepts an input iterable and returns an asynchronous iterable.

    Example

    const input = [1, 2, 3];
    const asyncIterable = async<number>()(input);

    (async () => {
    for await (const x of asyncIterable) {
    console.log(x); // Logs 1, 2, 3
    }
    })();

    Type Parameters

    • T

      The type of elements in the input iterable.

    Returns ((input: AnyIterable<T>) => AsyncIterable<Awaited<T>>)

      • (input: AnyIterable<T>): AsyncIterable<Awaited<T>>
      • Parameters

        Returns AsyncIterable<Awaited<T>>

Generated using TypeDoc