util.math.restrict

Static function.

Restricts an input numeric value to the set minimum and maximum limits.

Returns value can be limited.

{ Number } util.math.restrict(value, min, max)

Parameters:

Parameter Default value Description
value *

Type: Number

Value can be limited.

min *

Type: Number

Minimum limit.

max *

Type: Number

Maximum limit.

* Mandatory parameter/option.

Example:

ymaps.util.math.restrict(-250, -180, 180) = -180