Skip to content

toArray<T>

Converts an AsyncIterableIterator to an array by consuming all its elements.

Import:

import { toArray } from '@mnaoumov/typescript-lib/async';

Signature:

function toArray(iter: AsyncIterableIterator<T>): Promise<T[]>

Parameters:

Parameter Type Description
iter AsyncIterableIterator<T> The AsyncIterableIterator to convert.

Returns: Promise<T[]> — A Promise that resolves with an array of all the elements in the AsyncIterableIterator.