Physical quantity representation and conversion
Can be used in the browser or in Node. Compatible with browser stand-alone, CommonJS and AMD.
Create a new
Quantity object to hold
var kg101 = 101 QuantityKG;var lb202 = ; // will do an implicit 'new' for youkg101value === 101;lb202value === 202;kg101units === 'kg' === QuantityKG;lb202units === 'lb' === QuantityLB;
Units available are:
QuantityKG // kilogramsQuantityLB // poundsQuantityMM // millimetresQuantityCM // centimetresQuantityM // metresQuantityIN // inches
Quantity object to another
Quantity object of specified `units.
var lb = 101 QuantityKG;lbvalue === 222667; // approxlbunits === 'lb';
Quantities is Copyright (c) 2013 Rod Vagg @rvagg and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
Note about style: this project is far from my normal coding style; it's roughly equivalent to "Crockford-style". It also uses Mocha, Chai and Istanbul which I also don't normally use. But it is my code! This project is for experimentation and teaching.