clampValue method

num clampValue(
  1. num min,
  2. num max
)

Implementation

num clampValue(num min, num max) {
  return (this < min)
      ? min
      : (this > max)
      ? max
      : this;
}