We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
clamp is a method that returns a value clamped to a given range.
val: number
The requested value.
min: number
The bottom of the permitted range.
max: number
The top of the permitted range.
val
min
max
clamp
import { clamp } from '@revolutionarygamesco/common' clamp(0, 1, 10) // 1 clamp(1, 1, 10) // 1 clamp(5, 1, 10) // 5 clamp(10, 1, 10) // 10 clamp(11, 1, 10) // 10