jumpstorm/engine/utils/clamp.ts

3 lines
101 B
TypeScript

export const clamp = (num: number, min: number, max: number) =>
Math.min(Math.max(num, min), max);