Unit.format()method
format(amount: number, options?: UnitFormatOptions): string
Format an amount with a given unit of measure, e.g. 12 kg or 29.5 l
- Uses
Intl.NumberFormatif this is a supported unit (so e.g.ounceis translated to e.g.Unzein German). - Polyfills unsupported units to use long/short form based on
options.unitDisplay.