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

x/rimbu/common/async-reducer.ts>AsyncReducer.toJSMap

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

Returns a AsyncReducer that collects received input tuples into a mutable JS Map, and returns a copy of that map when output is requested.

Examples

Example 1

await AsyncStream.of([1, 'a'], [2, 'b']).reduce(AsyncReducer.toJSMap()))
// Map { 1 => 'a', 2 => 'b' }