Nice unit of measure conversion, featuring:
measurement('Temperature').convert(20) .from(measurement.Unit.Temperature.CELSIUS) .to(measurement.Unit.Temperature.FAHRENHEIT); // returns 68 measurement('Distance').convert(1) .from(measurement.Unit.Distance.KILOMETRE) .to(measurement.Unit.Distance.METRE); // returns 1000 measurement('Speed').convert(10) .from(measurement.Unit.Speed.KILOMETRE_PER_HOUR) .to(measurement.Unit.Speed.METRE_PER_SECOND); // returns 2.7777777777777777
The API definition and all conversion operations are covered by jasmine tests. The test suite can be executed straightaway and easily, for example:
Test directly in the browser Simply open test/index.html in the browser
PhantomJs via Karma test driver
npm run-script karma
That command is just a shorthand for
node_modules/.bin/karma start. If you have
karma-cli already installed globally, you can also just do
Karma will startup and run all tests on phantomjs
Any Browser you like with Karma
npm run-script karmaor
npm testor ... (see above)
For current and future state of affairs, have a peek at the Roadmap in the root project folder.
Currently you only need to download and include measurement.js in your project.
latest release - install via NPM:
In case the node package manager is part of your development stack, this may be more comfortable for you:
Please feel free to add your own test results.
PhantomJS 1.9.7 (Linux): Executed 46 of 46 SUCCESS (0.027 secs / 0.022 secs) Chrome 18.0.1025 (Linux): Executed 46 of 46 SUCCESS (0.06 secs / 0.035 secs) Firefox 28.0.0 (Ubuntu): Executed 46 of 46 SUCCESS (0.037 secs / 0.026 secs)