Function await_

  • Given an async iterator whose values are promises, returns an async iterator that awaits each promise. Use it as it.await(...).

    Type Parameters

    • V

    Parameters

    • it: AnyIt<Promise<V>>

    Returns AIt<V>

    Example

    const result = it.pipe(
    [true, false, true],
    it.map((x) => Promise.resolve({ success: x })), // eg. fetch something from a server
    it.await, // await each promise, returning an async iterator
    it.filter(({ success }) => success), // await is transparently handling the promise for you
    )