Skip to content

RollingAverage

Defined in: math/rolling-average.ts:13

A simple implementation of a rolling average calculator that maintains a fixed-size window of the most recent values. When a new value is added and the window exceeds the specified size, the oldest value is removed. The average is calculated based on the current values in the window.

See

ImmutableRollingAverage for an immutable version of the rolling average calculator.

Methods

add()

add(value): void

Defined in: math/rolling-average.ts:14

Parameters

value

number

Returns

void


getAverage()

getAverage(): Either<number, string>

Defined in: math/rolling-average.ts:15

Returns

Either<number, string>