Is there are reputable and prehensive unit conversion Javascript library? I do not want any libraries that makes AJAX calls to WolframAlpha or Google but something that does the calculation locally.
Is there are reputable and prehensive unit conversion Javascript library? I do not want any libraries that makes AJAX calls to WolframAlpha or Google but something that does the calculation locally.
Share Improve this question asked Jul 17, 2013 at 2:54 pathikritpathikrit 33.5k39 gold badges153 silver badges229 bronze badges 4- 2 Check here stackoverflow./questions/865590/… – elclanrs Commented Jul 17, 2013 at 3:01
- 1 Check this out: stackoverflow./a/3531444/864385 – Shawn31313 Commented Jul 17, 2013 at 3:01
- Nice one ;) @elclanrs – Shawn31313 Commented Jul 17, 2013 at 3:01
- Possible duplicate of Unit of Measure Conversion Library – Anderson Green Commented Jun 29, 2018 at 17:12
2 Answers
Reset to default 5The math.js library es with support for units. The library does not yet support derived units but that is on the planning.
http://mathjs/
Example usage:
math.evaluate('2 inch in cm');
math.evaluate('0.5kg + 33g');
math.evaluate('cos(45 deg)');
The library "measure" converts between unit types (volume, mass, etc.) and supports multiple unit systems (US, Imperial, Metric)
// volume
measure('1 teaspoon').teaspoons() // 1
measure('1 1/2 tsp.').teaspoons() // 1.5
measure('2 cups and 1 pint').quarts() // 1
// mass
measure('1 pound').ounces() // 16
measure('1 1/2 oz.').ounces() // 1.5
// operations
measure('1 teaspoon').add('1 teaspoon').teaspoons();
measure('6 1/2 teaspoon').divide(2).teaspoons(); // 3.25
https://github./dubbs/measure