pow static method

Value pow(
  1. Object base,
  2. Object? exponent
)

Creates a pow() calculation with the given base and exponent.

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 pow(Object base, Object? exponent) {
  var args = [base, if (exponent != null) exponent];
  _verifyLength(args, 2);
  base = _simplify(base);
  exponent = exponent.andThen(_simplify);
  if (base is! SassNumber || exponent is! SassNumber) {
    return SassCalculation._("pow", args);
  }
  base.assertNoUnits();
  exponent.assertNoUnits();
  return number_lib.pow(base, exponent);
}