🗜️ Clamps a number between a specified minimum and maximum value.
Syntax
import { clamp } from '@opentf/std';
clamp(val: number, min: number, max: number): numberParameters
val: The number to clamp.min: The lower bound of the range.max: The upper bound of the range.
Returns
The clamped number.
Examples
clamp(10, -5, 5) //=> 5
clamp(0, 1000, 1366) //=> 1000
clamp(1001, 1000, 1366) //=> 1001
clamp(1500, 1000, 1366) //=> 1366