Skip to content
EliteChart

clampReplayIndex

Documentation


Documentation / @elitechart/core / clampReplayIndex

code
function clampReplayIndex(index, barCount): number;

Defined in: replay/replay-state.ts:58

Clamp a replay index to the valid [0, barCount - 1] range.

Parameters

index

number

barCount

number

Returns

number

Example

code
import { clampReplayIndex } from '@elitechart/core';
clampReplayIndex(500, 100); // 99
clampReplayIndex(-5, 100);  // 0