7 lines
147 B
JavaScript
7 lines
147 B
JavaScript
/**
|
|
* Clamps a number between a minimum and maximum value.
|
|
*/
|
|
export function clamp(n, min, max) {
|
|
return Math.min(max, Math.max(min, n));
|
|
}
|