log static method

Value log(
  1. Object number,
  2. Object? base
)

Creates a log() calculation with the given number and base.

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.

If arguments contains exactly a single argument, the base is set to math.e by default.

Implementation

static Value log(Object number, Object? base) {
  number = _simplify(number);
  base = base.andThen(_simplify);
  var args = [number, if (base != null) base];
  if (number is! SassNumber || (base != null && base is! SassNumber)) {
    return SassCalculation._("log", args);
  }
  number.assertNoUnits();
  if (base is SassNumber) {
    base.assertNoUnits();
    return number_lib.log(number, base);
  }
  return number_lib.log(number, null);
}