The unit's {@link UnitFormat}. Holds the unit's unique symbols,
which allow the parser to recognize the unit in a string.
Added to that it provides the basis for the .format()
method of the Convertible.
Converts a value from the group's base unit to this unit.
The unit's Group. Units belonging to the same group are convertible into each other.
The unit system the unit is belonging to. E.g. imperial
, metric
, ...
This meta information is used for the Convertible's .asBest()
method.
By default, the Convertible always remains in the same system of units.
Converts a value from this unit to the group's base unit.
Creates a string array holding all this unit's different notations.
a string array holding all this unit's different notations
Returns an array of units to which this unit can be converted.
an array of units to which this unit can be converted
Returns the unit's standard string representation - therefore the most common symbol. For example 'm'
is returned for the unit meter.
the unit's standard string representation
Generated using TypeDoc
Represents a standard measure that is used to express amounts.
A unit is always part of one single Group (attribute: Unit.group). It is always defined in relation to the base unit of its group.
The exact relation is defined in the converter functions Unit.fromBase and Unit.toBase. Thereby
fromBase(val: number) => number
defines the conversion from the base unit tothis
andtoBase(val: number) => number
vice versa. As a result of this simple concept, all units of a group are convertible into each other.The 4th important property of each unit is its Unit.format. This defines the unit's shape. It allows firstly the parser to recognize the unit in a string and secondly it provides the basis for the
.format()
method of the Convertible.Lastly every unit is part of a unit system (attribute: Unit.system). This meta information is used for the Convertible's
.asBest()
method. By default, the Convertible always remains in the same system of units.