Haxe unit library
Haxe Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
doc update docs Dec 23, 2016
dump/js/thx/unit/length/_Foot fix double pattern matching warning Dec 22, 2016
hxml removed debug May 17, 2015
src/thx/unit fix double pattern matching warning Dec 22, 2016
test changed condition Nov 4, 2015
.gitignore added API doc generation and fixes to aliases Sep 29, 2014
.travis.yml fix double pattern matching warning Dec 22, 2016
README.md doc Oct 14, 2014
build.hxml updated to use new generator Oct 11, 2015
extraParams.hxml minor Aug 24, 2014
generate regenerated files Oct 24, 2015
tests.hxml fix double pattern matching warning Dec 22, 2016



Build Status

The library contains type definitions for several kind of units. They are defined as asbtract types to simplify their usage as much as possible.

(10 : Millimetre) * 100 == (1 : Metre);
// other example
var f = (27 : Celsius).toFahrenheit()

The following units are currently supported:

For now the library essentially helps with conversions and math operations. At some point derivative units might be introduced to make things more interesting.

Also notice that the types are automatically generated. If you want to contribute to the library make sure to make changes in the definitions. The code is generated using this generator.

The library has not been exhaustively tested, please pay attention to the correctness of the results you get.

Important. This library should be used with the knowledge that converting values and perform some operations on the values might result in loss of precision. The limitation come from the fact that the underlying type is Float. Converting LightYears to Millimitres might not work as well as you expect!


From the command line just type:

haxelib install thx.unit

To use the dev version do:

haxelib git thx.core https://github.com/fponticelli/thx.unit.git