Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/common/mod.ts>AsyncReducer.toArray

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
function AsyncReducer.toArray
import { AsyncReducer } from "https://deno.land/x/rimbu@0.13.0/common/mod.ts";
const { toArray } = AsyncReducer;

Returns an AsyncReducer that collects received input values in an array, and returns a copy of that array as an output value when requested.

Examples

Example 1

await AsyncStream.of(1, 2, 3).reduce(AsyncReducer.toArray()))
// => [1, 2, 3]