node package manager


Prettify measurements to readable strings.

Format Measurement

It formats measurements!

npm install format-measurement
var fmt = require('format-measurement');
fmt.metric.weight(1000) // -> '1 kg' 
fmt.metric.weight(10) // -> '10 g' 
fmt.metric.weight(15.686) // -> '15.69 g' 
fmt.metric.volume(1000) // -> '1 L' 
fmt.metric.volume(100) // -> '100 mL' 
fmt.metric.volume(15.686) // -> '15.69 mL' 

Most things. In fact, right now, format-measurement only supports metric weight and volume units - and not very many of them (kg, g, L, mL). You'require totally welcome to do my work for me, though!

You might be better looking for something XML based. But otherwise, format-measurement is MIT licensed.