- reduceAsync<T>(values, accumulator): Promise<T>
Parameters
- values: T[]
- accumulator: ((a: T, b: T) =>
| undefined
| null
| void
| T
| Promise<
| undefined
| null
| void
| T>)- (a, b):
| undefined
| null
| void
| T
| Promise<
| undefined
| null
| void
| T> Returns
| undefined
| null
| void
| T
| Promise<
| undefined
| null
| void
| T>
Returns Promise<T>
The accumulated result.
- reduceAsync<T, V>(values, accumulator, init): Promise<T>
Parameters
- values: V[]
- accumulator: ((a: T, b: V, i: number, values: V[]) =>
| undefined
| null
| void
| T
| Promise<
| undefined
| null
| void
| T>)- (a, b, i, values):
| undefined
| null
| void
| T
| Promise<
| undefined
| null
| void
| T> Parameters
- a: T
- b: V
- i: number
- values: V[]
Returns
| undefined
| null
| void
| T
| Promise<
| undefined
| null
| void
| T>
- init: T | Promise<T>
Returns Promise<T>
The accumulated result.
Similar to Array.reduce, but the accumulator can returns Promise.
Param: values
The array to be reduced.
Param: accumulator
A callback to be called for each value. If it returns null, the previous result will be kept.
Param: init
The initial value.
Returns
The accumulated result.