import { Reducer } from "https://deno.land/x/rimbu@1.1.0/core/mod.ts";
const { combine } = Reducer;
Returns a Reducer
that combines multiple input reducers
according to the given "shape" by providing input values to all of them and collecting the outputs in the shape.
Examples
Example 1
Example 1
const red = Reducer.combine([Reducer.sum, { av: [Reducer.average] }])
console.log(Stream.range({amount: 9 }).reduce(red))
// => [36, { av: [4] }]
Type Parameters
S extends Reducer.CombineShape<T>
Parameters
shape: S & Reducer.CombineShape<T>
- a shape defining where reducer outputs will be located in the result. It can consist of a single reducer, an array of shapes, or an object with string keys and shapes as values.