4.17.11
3.10.1
2.4.2
1.3.1
_.clamp(number, [lower], upper)
Clamps number
within the inclusive lower
and upper
bounds.
Since
4.0.0
Arguments
argument
number
[lower]
upper
type
number
number
number
description
The number to clamp.
The lower bound.
The upper bound.
Returns
(array)
Example
_.clamp(-10, -5, 5);
// => -5
_.clamp(10, -5, 5);
// => 5
_.clamp(-10, -5, 5);
// => -5
_.clamp(10, -5, 5);
// => 5