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

x/rimbu/core/mod.ts>Reducer.toJSMultiMap

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

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

Examples

Example 1

console.log(Stream.of([1, 'a'], [2, 'b']).reduce(Reducer.toJSMap()))
// Map { 1 => 'a', 2 => 'b' }

Returns

Reducer<[K, V], Map<K, V[]>>