Class: AccumulableParam

eclairjs.AccumulableParam

new AccumulableParam()

Helper object defining how to accumulate values of a particular type. An implicit AccumulableParam needs to be available when you create Accumulables of a specific type.
Source:

Methods

addAccumulator(r, t) → {object|Promise.<object>}

Add additional data to the accumulator value. Is allowed to modify and return `r` for efficiency (to avoid allocating objects).
Parameters:
Name Type Description
r object the current value of the accumulator
t object the data to be added to the accumulator
Source:
Returns:
  • the new value of the accumulator
    Type
    object
  • Promise that resolves to the new value of the accumulator
    Type
    Promise.<object>

addInPlace(r1, r2) → {Promise.<object>}

Merge two accumulated values together. Is allowed to modify and return the first value for efficiency (to avoid allocating objects).
Parameters:
Name Type Description
r1 object one set of accumulated data
r2 object another set of accumulated data
Source:
Returns:
Promise that resolves to a value that has both data sets merged together
Type
Promise.<object>

zero(initialValue) → {Promise.<object>}

Return the "zero" (identity) value for an accumulator type, given its initial value. For example, if R was a vector of N dimensions, this would return a vector of N zeroes.
Parameters:
Name Type Description
initialValue object
Source:
Returns:
Type
Promise.<object>