Methods
minMax(minValue, value, maxValue) → {*}
Checks if a value is within bounds of a minimum and maximum and returns the value or the upper or lower bound respectively.
Accepts all values comparable with > and <.
Parameters:
Name | Type | Description |
---|---|---|
minValue |
* | the lower bound |
value |
* | the value to check |
maxValue |
* | the upper bound |
Throws:
error if minValue is not smaller than maxValue
Returns:
value, minValue or maxValue
- Type
- *
Example
let croppedVal = minMax(-100, value, 100);