1export function clamp(v: number, min: number, max: number): number { 2 return Math.min(max, Math.max(min, v)) 3}