MCPcopy
hub / github.com/ilyhalight/voice-over-translation / clampNumber

Function clampNumber

src/utils/number.ts:1–5  ·  view source on GitHub ↗
(value: number, min: number, max: number)

Source from the content-addressed store, hash-verified

1export function clampNumber(value: number, min: number, max: number): number {
2 if (!Number.isFinite(value)) return min;
3 if (max < min) return min;
4 return Math.max(min, Math.min(max, value));
5}
6
7export function clampNumberWithSortedBounds(
8 value: number,

Callers 7

clampIntFunction · 0.90
volume01ToPercentFunction · 0.90
snapVolume01Function · 0.90
snapVolume01TowardsFunction · 0.90
valueMethod · 0.90
minMethod · 0.90
maxMethod · 0.90

Calls 2

maxMethod · 0.80
minMethod · 0.80

Tested by

no test coverage detected