method Enumerable.prototype.toArray
Enumerable.prototype.toArray(): Promise<T[]>

Collect all items from this async iterable into an array.

This is an alias for collect - both methods do exactly the same thing. Use whichever name feels more natural in your code.

Examples

Basic usage

import { enumerate } from "jsr:@j50n/proc";

const result = await enumerate([1, 2, 3]).toArray();
// [1, 2, 3]

Return Type

Promise<T[]>

A Promise resolving to an array of all items.

Usage

import { Enumerable } from ".";