Transform the value object into a formatted string converting it to the specified unit with the unit's symbol appended
The returned value is formatted using FixedPointNumber#getDisplayValue and is without any unit symbols or label
The value object to be formatted
The unit to convert into, must be compatible with the value object's unit
The formatted value with the unit's symbol appended
const value = { value: 1, unit: "m/s" }; const toUnit = "mm/s"; const convertedValue = valueConverter(value, toUnit); console.log(convertedValue); // outputs "1000 mm/s" Copy
const value = { value: 1, unit: "m/s" }; const toUnit = "mm/s"; const convertedValue = valueConverter(value, toUnit); console.log(convertedValue); // outputs "1000 mm/s"
Error if the value object and the provided unit are incompatible
Transform the value object into a formatted string converting it to the specified unit with the unit's symbol appended
The returned value is formatted using FixedPointNumber#getDisplayValue and is without any unit symbols or label