Skip to content

getAverage

getAverage(rollingAverage): Either<number, string>

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

Calculates the average of the current values in the rolling average window. If no values have been added, it returns an error message.

Parameters

rollingAverage

ImmutableRollingAverage

The current state of the rolling average

Returns

Either<number, string>

An Either containing the average of the values (Left) or an error message (Right) if no values have been added.