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
You can download, commit and fork the code on github here: extramaster/measurementsConverters
The entire library is stored in a single variable, which is a wrapper that contains all the main functionalities.
conversionObject
is the name of the variable in which the library resides in and is split into 3 parts, as documented below
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
Specifies the measurement type that is currently being manupilated: e.g
Angle
Specifies the current measurement unit that the value is in: e.g
Degree
The measurement unit to be converted to: e.g
Radian
The value to be processed as
from
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
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
Below are a couple of demonstrations of the library [view the page source to get the code!]