Skip to main content

type last

Returns an AsyncReducer that remembers the last input value.

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

Definition

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