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

x/rimbu/stream/async/async-reducer.ts>AsyncReducer.race

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

Returns an AsyncReducer 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: AsyncReducer.Accept<T, R>[], otherwise: AsyncOptLazy<O>): AsyncReducer<T, R | O>; <T, R>(reducers: AsyncReducer.Accept<T, R>[]): AsyncReducer<T, R | undefined>; }