Closed jonaskello closed 3 years ago
It seems like UnitFormat has been refactored to the point where it bascially does nothing. Could it be removed?
The README has an example of using UnitFormat.getUnitFormat() that takes an Amount but this is not how the code actually works anymore:
UnitFormat.getUnitFormat()
Amount
This is the example:
const length = Amount.create(10, Units.Meter); const format = UnitFormat.getUnitFormat(length); console.log( "The amount is " + Math.round(Amount.valueAs(Units.Inch, amount), format.decimalCount) + " " + format.label );
This is how the code works:
export function getUnitFormat( unit: Unit.Unit<unknown>, unitsFormat: UnitFormatMap ): UnitFormat | undefined { return unitsFormat[unit.name]; }
It turns out UnitFormat is used in the uom-units package. The example was changed in this commit to reflect this.
UnitFormat
uom-units
It seems like UnitFormat has been refactored to the point where it bascially does nothing. Could it be removed?
The README has an example of using
UnitFormat.getUnitFormat()
that takes anAmount
but this is not how the code actually works anymore:This is the example:
This is how the code works: