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

x/rimbu/core/mod.ts>AsyncReducer.toJSObject

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

Returns an AsyncReducer that collects 2-tuples containing keys and values into a plain JS object, and returns a copy of that object when output is requested.

Examples

Example 1

await AsyncStream.of(['a', 1], ['b', true]).reduce(AsyncReducer.toJSObject()))
// { a: 1, b: true }

Type Parameters

K extends string | number | symbol
V

Returns

AsyncReducer<[K, V], Record<K, V>>