Skip to main content
Module

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

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

Returns a Reducer that feeds incoming values to all reducers in the provided reducers source, and halts when the first reducer in the array is halted and returns the output of that reducer. Returns the otherwise value if no reducer is yet halted.

type

{ <T, R, O>(reducers: StreamSource<Reducer<T, R>>, otherwise: OptLazy<O>): Reducer<T, R | O>; <T, R>(reducers: StreamSource<Reducer<T, R>>): Reducer<T, R | undefined>; }