Skip to content

Documentation / base / clamp

Function: clamp()

clamp(v, min, max): number

Defined in: libs/base/src/math/misc.ts:83

Clamps a number within the inclusive range [min, max].

Parameters

v

number

The input value.

min

number

The lower bound.

max

number

The upper bound.

Returns

number

The value constrained to the range [min, max].

Released under the MIT License.