function clamp(val, min, max,) {
    return val > max
        ? max
        : val < min
            ? min
            : val;
}
Clamps number between min and max
@param {Number} val
@param {Number} min
@param {Number} max
@return {Number}