Skip to content

addValue

addValue(rollingAverage, value): ImmutableRollingAverage

Defined in: math/fp/rolling-average.ts:53

Adds a new value to the rolling average. If the number of values exceeds the maximum size, the oldest value is removed.

Parameters

rollingAverage

ImmutableRollingAverage

The current state of the rolling average

value

number

The new value to add to the rolling average

Returns

ImmutableRollingAverage

An object containing a new instance of ImmutableRollingAverage with the updated values