- reduce<T, R>(cb, initialValue?): Operation<T, R>
-
Parameters
-
cb: ((previousValue, currentValue, index, state) => R | Promise<R>)
-
- (previousValue, currentValue, index, state): R | Promise<R>
-
Parameters
-
previousValue: R
-
currentValue: T
-
index: number
-
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: