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

x/rimbu/core/main/index.ts>AsyncReducer.combineArr

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

Returns an AsyncReducer 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 = AsyncReducer.combineArr(AsyncReducer.sum, AsyncReducer.average)

await AsyncStream.from(Stream.range({ amount: 9 }))
 .reduce(red)
// => [36, 4]

Type Parameters

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

Parameters

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