Utils.clamp()
Clamp the number givens as first parameter into the limits of the min and max numbers given as second ans third parameters
Parameters
Name | Type | Description | |
---|---|---|---|
1 | x | number | |
2 | min | number | |
3 | max | number |
Return value
number
the result
Usage
import {Utils} from '@lcluber/type6js';
let clamp = Utils.clamp(2,4,10);
console.log(clamp); //4