mod static method
Creates a mod()
calculation with the given dividend
and modulus
.
Each argument must be either a SassNumber, a SassCalculation, an unquoted SassString, or a CalculationOperation.
This automatically simplifies the calculation, so it may return a SassNumber rather than a SassCalculation. It throws an exception if it can determine that the calculation will definitely produce invalid CSS.
This may be passed fewer than two arguments, but only if one of the
arguments is an unquoted var()
string.
Implementation
static Value mod(Object dividend, Object? modulus) {
dividend = _simplify(dividend);
modulus = modulus.andThen(_simplify);
var args = [dividend, if (modulus != null) modulus];
_verifyLength(args, 2);
_verifyCompatibleNumbers(args);
if (dividend is! SassNumber ||
modulus is! SassNumber ||
!dividend.hasCompatibleUnits(modulus)) {
return SassCalculation._("mod", args);
}
return dividend.modulo(modulus);
}