Skip to main content

type race

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.

Definition

race: {
    <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>;
  }