function Unit(value, name) {
    if (!(this instanceof Unit)) {
      throw new Error('Constructor must be called with the new operator');
    }

    if (!(value === null || value === undefined || isNumeric(value) || type.isComplex(value))) {
      throw new TypeError('First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined');
    }

    if (name !== undefined && (typeof name !== 'string' || name === '')) {
      throw new TypeError('Second parameter in Unit constructor must be a string');
    }

    if (name !== undefined) {
      var u = Unit.parse(name);
      this.units = u.units;
      this.dimensions = u.dimensions;
    } else {
      this.units = [{
        unit: UNIT_NONE,
        prefix: PREFIXES.NONE,
        // link to a list with supported prefixes
        power: 0
      }];
      this.dimensions = [];

      for (var i = 0; i < BASE_DIMENSIONS.length; i++) {
        this.dimensions[i] = 0;
      }
    }

    this.value = value !== undefined && value !== null ? this._normalize(value) : null;
    this.fixPrefix = false; // if true, function format will not search for the
    // best prefix but leave it as initially provided.
    // fixPrefix is set true by the method Unit.to
    // The justification behind this is that if the constructor is explicitly called,
    // the caller wishes the units to be returned exactly as he supplied.

    this.skipAutomaticSimplification = true;
  }
A unit can be constructed in the following ways:

    const a = new Unit(value, name)
    const b = new Unit(null, name)
    const c = Unit.parse(str)

Example usage:

    const a = new Unit(5, 'cm')               // 50 mm
    const b = Unit.parse('23 kg')             // 23 kg
    const c = math.in(a, new Unit(null, 'm')  // 0.05 m
    const d = new Unit(9.81, "m/s^2")         // 9.81 m/s^2

@class Unit
@constructor Unit
@param {number | BigNumber | Fraction | Complex | boolean} [value]  A value like 5.2
@param {string} [name]   A unit name like "cm" or "inch", or a derived unit of the form: "u1[^ex1] [u2[^ex2] ...] [/ u3[^ex3] [u4[^ex4]]]", such as "kg m^2/s^2", where each unit appearing after the forward slash is taken to be in the denominator. "kg m^2 s^-2" is a synonym and is also acceptable. Any of the units can include a prefix.