Skip to main content

type first

Returns an AsyncReducer that remembers the first input value.

example
await AsyncStream.from(Stream.range{ amount: 10 })).reduce(AsyncReducer.first())
// => 0

Definition

first: {
    <T>(): AsyncReducer<T, T | undefined>;
    <T, O>(otherwise: AsyncOptLazy<O>): AsyncReducer<T, T | O>;
  }