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

x/rimbu/core/mod.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.0/core/mod.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>; }

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>; }