How can we generate a pretty quantity (eg.96 °C, 10 µA) from a Qty? js-quantities has an API for formatting output, including specifying custom formatter functions, but this formatting seems to be concerned with the number rather than the unit.
Our team is developing a tool to monitor the health of instruments sold by our customers. Basically, instruments installed at customer site report back low-level telemetry like fan speeds, temperatures, power, etc. We use js-quantities in several places, including in the dashboards (single page webapps) to display the data in a preferred unit. For example, the instruments might transmit a property as 0.001238 amps but we display as 1.2 µA. We use js-quantitites to do the conversion and rounding, and then handle the unit itself in our code.
However, we need to display pretty quanties in more places than one product so we're consider writing a module to handle prettifying the unit. Has a "pretty units" feature ever been for js-quantities? Would a PR be welcomed adding this feature?
How can we generate a pretty quantity (eg.
96 °C
,10 µA
) from aQty
?js-quantities
has an API for formatting output, including specifying custom formatter functions, but this formatting seems to be concerned with the number rather than the unit.Our team is developing a tool to monitor the health of instruments sold by our customers. Basically, instruments installed at customer site report back low-level telemetry like fan speeds, temperatures, power, etc. We use js-quantities in several places, including in the dashboards (single page webapps) to display the data in a preferred unit. For example, the instruments might transmit a property as
0.001238 amps
but we display as1.2 µA
. We usejs-quantitites
to do the conversion and rounding, and then handle the unit itself in our code.However, we need to display pretty quanties in more places than one product so we're consider writing a module to handle prettifying the unit. Has a "pretty units" feature ever been for
js-quantities
? Would a PR be welcomed adding this feature?