clip method

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

Clips (limits) this num to the range from min to max (inclusive).

Implementation

num clip(num min, num max) => this < min
    ? min
    : max < this
        ? max
        : this;