coerceValueToMatch method

double coerceValueToMatch(
  1. SassNumber other, [
  2. String? name,
  3. String? otherName
])

Returns value, converted to the same units as other.

Unlike convertValueToMatch, this does not throw an error if this number is unitless and other is not, or vice versa. Instead, it treats all unitless numbers as convertible to and from all units without changing the value.

Throws a SassScriptException if this number's units aren't compatible with other's units.

If this came from a function argument, name is the argument name (without the $) and otherName is the argument name for other. These are used for error reporting.

Implementation

double coerceValueToMatch(SassNumber other,
        [String? name, String? otherName]) =>
    _coerceOrConvertValue(other.numeratorUnits, other.denominatorUnits,
        coerceUnitless: true, name: name, other: other, otherName: otherName);