Skip to content

clamp

clamp(min, max): (n) => number

Defined in: Utils/Num.ts:55

Clamps a number between min and max (both inclusive).

number

number

(n): number

number

number

pipe(150, Num.clamp(0, 100)); // 100
pipe(-5, Num.clamp(0, 100));  // 0
pipe(42, Num.clamp(0, 100));  // 42