4 lines
83 B
JavaScript

export function clamp(x, min, max) {
return Math.min(Math.max(x, min), max);
}