- reduce<T, R>(cb, initialValue?): Operation<T, R>
Parameters
- cb: ((previousValue: R, currentValue: T, index: number, state: IterationState) => R | Promise<R>)
- (previousValue, currentValue, index, state): R | Promise<R>
Returns R | Promise<R>
Optional
initialValue: R | Promise<R>
Standard reducer for the iterable, extended for fully async syntax + iteration state.
Below is an example of calculating the average from a sequence of numbers: