clampValue = (number, min, max) => {
  // @ts-ignore
  if (Number.isNaN(parseInt(number, 10))) {
    return min;
  }
  return Math.max(min, Math.min(number, max));
}
Clamp the given number between the given range.

@param {number} number The number to clamp.
@param {number} min The minimum value.
@param {number} max The maximum value.
@returns {number} The clamped number.