Class: Reduce

rg-async. Reduce

Defines a Reduce class. Provides a reduce method that will run in series).


new Reduce()

Author:
Source:

Methods


<static> reduce(srcArray, reduce, accumulator)

Invokes in series an async reducer function on each item in the given source Array.

Invokes in series an async reducer function on each item in the given source Array. The reducer function transforms an accumulator value based on each item iterated over

Parameters:
Name Type Description
srcArray Array

Specifies the source array to reduce over.

reduce function

Specifies the async function that will be called with (accumulator, currValue, index, array) as arguments and returns a new value for accumulator.

accumulator *

Specifies the initial accumulator value

Source:
Returns:

Returns a promise to be resolved containing final accumulator value.

Type
Promise