mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-02 08:06:00 +00:00
6 lines
206 B
TypeScript
6 lines
206 B
TypeScript
export function clampNumber(value: number, min: number, max: number): number {
|
|
const lower = Math.min(min, max);
|
|
const upper = Math.max(min, max);
|
|
return Math.max(lower, Math.min(value, upper));
|
|
}
|