Unit

Abstract base class of BaseUnit and DerivedUnit.

Methods

static isUnit(value)

Returns true if `value` is an instance of Unit; false otherwise.
Parameters:
Name Type Description
value * the value to be checked

abstract dimensions() → {Dimensions}

Returns the Dimensions of this Unit.
Returns:
Dimensions

abstract expression() → {UnitExpression}

Returns:
UnitExpression
Deprecated:
  • Yes
To Do:
  • remove this method from Unit

abstract isBaseUnit() → {boolean}

Returns true if this Unit is an instance of BaseUnit, or false if it is an instance of DerivedUnit.
Returns:
boolean

name() → {string}

The name of the Unit.
Returns:
string

scale() → {number}

The scale of the Unit.
Returns:
number

symbol() → {string}

The symbol of the Unit, used in toString() representations. For instance, the symbol for "meter" is "m".
Returns:
string

toString() → {string}

Returns the string representation of the Unit (which is typically its symbol).
Returns:
string