coerceToMatch method
Returns a copy of this number, converted to the same units as other
.
Unlike convertToMatch, 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.
Note that coerceValueToMatch is generally more efficient if the value is going to be accessed directly.
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
SassNumber coerceToMatch(SassNumber other,
[String? name, String? otherName]) =>
SassNumber.withUnits(coerceValueToMatch(other, name, otherName),
numeratorUnits: other.numeratorUnits,
denominatorUnits: other.denominatorUnits);