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

x/rimbu/common/internal.ts>Reducer.combineArr

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

Returns a Reducer that combines multiple input reducers by providing input values to all of them and collecting the outputs in an array.

Examples

Example 1

const red = Reducer.combineArr(Reducer.sum, Reducer.average)
console.log(Stream.range({amount: 9 }).reduce(red))
// => [36, 4]

Type Parameters

T
R extends readonly [unknown, unknown, ...unknown[]]

Parameters

...reducers: [K in keyof R]: Reducer<T, R[K]> & Reducer<T, unknown>[]
  • 2 or more reducers to combine