valueInRange method

double valueInRange(
  1. num min,
  2. num max,
  3. [String? name]
)

If value is between min and max, returns it.

If value is fuzzyEquals to min or max, it's clamped to the appropriate value. Otherwise, this throws a SassScriptException. If this came from a function argument, name is the argument name (without the $). It's used for error reporting.

Implementation

double valueInRange(num min, num max, [String? name]) {
  if (fuzzyCheckRange(value, min, max) case var result?) return result;
  throw SassScriptException(
      "Expected $this to be within $min$unitString and $max$unitString.",
      name);
}