UnitList.convert()method
Convert an amount from a unit in this list to another unit in this list.
convert(amount: number, sourceKey: K, targetKey: K): number
new UnitList<K>(units: ImmutableObject<K, UnitProps<K>>)
| Param | Type | |
|---|---|---|
units | ImmutableObject<K, UnitProps<K>> | Any readonly object. required |
| Return | |
|---|---|
UnitList<K> | Represent a list of related units of measure (e.g. all length units). |
| Property | Type | |
|---|---|---|
.base | Unit<K> | Base unit for this list (the first unit added). required readonly |
Represent a list of related units of measure (e.g. all length units).
.base.unit()Convert an amount from a unit in this list to another unit in this list.
convert(amount: number, sourceKey: K, targetKey: K): number
Require a unit from this list.
require(key: K): Unit<K>