About

Measurements Converters is a measurement unit conversion library that aims to include all different type of measurement units from different measurement systems together, with an included function allows for the easy conversion of measurement values inside of the library measurements table. This project is licensed under a MIT license and is open to contributors. Project created by eXtraMaster

Download

You can download, commit and fork the code on github here: extramaster/measurementsConverters

Documentation

The entire library is stored in a single variable, which is a wrapper that contains all the main functionalities.

The wrapper

conversionObject is the name of the variable in which the library resides in and is split into 3 parts, as documented below

The function

There is only one function that is included with the library, under the functions section. The use of which is as follows


conversionObject.functions.converter(context, from, to, subject)

Returns an integer when the proper values are inputted

Context

Specifies the measurement type that is currently being manupilated: e.g Angle

From

Specifies the current measurement unit that the value is in: e.g Degree

To

The measurement unit to be converted to: e.g Radian

Subject

The value to be processed as from

Note!

Please note that the context from and to values are all case sentitive, and typically require the first letter to be capitialized, ie: Radian is not the same as radian

The table

conversionObject.special is where the irregular measurement conversions are stored

conversionObject.master is where the linear and regular measurement conversions are stored

Both can be directly accessed and manupliated [as an array], however it is recommended to use the conversionObject.functions.converter function to complete basic calculation tasks

Conversion values

Demo

Below are a couple of demonstrations of the library [view the page source to get the code!]

Radians to Degrees


Full conversion

Convert: from to in