Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@lhncbc/ucum-lhc

lhncbc128.3kSEE LICENSE IN LICENSE.md7.1.3

Implements Unified Code for Units of Measure (UCUM) functions in a javascript library

readme

ucum-lhc

This is the LHC implementation of validation and conversion services based on the Unified Code for Units of Measure (UCUM) code system created by the Regenstrief Institute, Inc.

See our overview page for general information.

This is a work in progress so more capabilities will probably be introduced.

Check out the Demo page

We have a demo page that shows various capabilities. That includes the validation and conversion functions described below. You might want to try that out first.

Get the code

The ucum-lhc code is written as ES6 modules, but the npm package (see below) also contains CommonJS modules, as well as a "browser-dist" directory with files ready to use in a web browser.

Currently we have code to serve multiple purposes. The core code supports the validation and conversion of UCUM unit expressions as well as a function to search for commensurable units for a specified unit expression. Other code is concerned with importing and exporting the UCUM data, and in supporting the demo page (noted above). If you are looking to include the ucum-lhc core code in your application, download the code as an npm package.

Getting the code as an npm package

You can use the npm package manager to install the ucum-lhc npm package. (npm is automatically installed with Node.js.)

npm install @lhncbc/ucum-lhc --save

This will install the @lhncbc/ucum-lhc directory in your node_modules diretory. The browser-dist subdirectory will contain ucum-lhc.min.js for use directly in a browser.

Using the code

The ucum-lhc.min.js file includes the source code you need for the validation, conversion and commensurable units functions as well as the ucum code definitions file. We assume that your main motivation for including the ucum-lhc code is to have those capabilities for units of measure on your system.

Server side

To access those capabilities from your server side code (or from client side code that goes through a build system), require the npm package and create a UcumLhcUtils object that contains those functions.

const ucum = require('@lhncbc/ucum-lhc');
const utils = ucum.UcumLhcUtils.getInstance();

Client side

To access those capabilities from your client side code, include the ucum-lhc.min.js package in your html file.

<script src="path-to-installed-package/browser-dist/ucum-lhc.min.js"></script>

The validation, conversion and commensurable units functions are available from the ucumPkg.UcumLhcUtils class. In your client side javascript code access those functions via the ucumPkg object. For example,

var parseResp = ucumPkg.UcumLhcUtils.getInstance().validateUnitString(uStr, true);

Function descriptions

Below is documentation for the public functions on the UcumLhcUtils instance.

validateUnitString(uStr, suggest)

This method validates a unit string. It first checks to see if the string passed in is a unit code that is found in the unit codes table. If it is not found it parses the string to see if it resolves to a valid unit string.

If a valid unit cannot be found, the string is tested for some common errors, such as missing brackets or a missing multiplication operator. If found, the error is reported in the messages array that is returned.

If a valid unit cannot be found and an error cannot be discerned, this may return, if requested, a list of suggested units in the suggestions array that is returned. Suggestions are based on matching the expression with unit names and synonyms.

Parameters: 1) uStr: the string to be validated; 2) suggest: a boolean to indicate whether or not suggestions are requested for a string that cannot be resolved to a valid unit; true indicates suggestions are wanted; false indicates they are not, and is the default if the parameter is not specified;

Returns: an object with five properties:

  • 'status' will be 'valid' (the uStr is a valid UCUM code), 'invalid' (the uStr is not a valid UCUM code, and substitutions or suggestions may or may not be returned, depending on what was requested and found); or 'error' (an input or programming error occurred);
  • 'ucumCode' the valid ucum code, which may differ from what was passed in (e.g., if 'Gauss' is passed in, this will contain 'G') OR null if the string was flagged as invalid or an error occurred;
  • 'msg' is an array of messages, if the string is invalid or an error occurred, indicating the problem, or an explanation of a substitution such as the substitution of 'G' for 'Gauss', or an empty array if no messages were generated ;
  • 'unit' which is null if no unit is found, or a hash for a unit found:
    • 'code' is the unit's ucum code (G in the above example);
    • 'name' is the unit's name (Gauss in the above example); and
    • 'guidance' is the unit's guidance/description data.
  • 'suggestions' if suggestions were requested and found, this is an array
    of one or more hash objects.  Each hash contains three elements:
    • 'msg' which is a message indicating what part of the uStr input parameter the suggestions are for;
    • 'invalidUnit' which is the unit expression the suggestions are for; and
    • 'units' which is an array of data for each suggested unit found. Each array will contain the unit code, the unit name and the unit guidance (if any). If no suggestions were requested and found, this property is not returned.

For example, to validate a unit string of m2/g4 (assuming you have created a utils object as described above):

 var returnObj = utils.validateUnitString('m2/g4');
 if (returnObj['status'] === 'valid')
   /* the string is valid; returnObj['ucumCode'] will contain the valid 
      ucum code (may differ from what was entered), returnObj['msg'] may 
      contain a message or messages describing substitution(s) for the
      code entered, and retObj['unit'] will contain 3 pieces of data for the 
      unit - code, name and guidance (provides information about the unit, 
      such as how the unit is used, etc.)*/
 else
   /* returnObj['status'] will be 'invalid' and */
   /* returnOb['msg'] will have a message describing the problem */

For information on unit string formatting, look at the Ucum Unit Expression Validation section on the demo page.
There is a button labeled "Show entry hints". That will give you a short description of unit strings, and includes a link to the UCUM Specification, where you can find the full deal.

convertUnitTo(fromUnitCode, fromVal, toUnitCode, options)

This method converts a number of one type of unit to the equivalent number of another type of unit. Note that the number returned is not trimmed or rounded to any particular precision or significant digits.

Disclaimer: Conversion results should be verified independently before using them in actual clinical settings.

Parameters: 1) fromUnitCode: the unit code/expression/string of the unit to be converted; 2) fromVal: the number of "from" units to be converted to "to" units; 3) toUnitCode: the unit code/expression/string of the unit that the from field is to be converted to; 4) options: an optional hash of options that can be passed in:

  • 'suggestions' a boolean to indicate whether or not suggestions are wanted for a string that cannot be resolved to a valid unit; true indicates suggestions are wanted; false indicates they are not, and is the default if the parameter is not specified;
  • 'molecularWeight' the molecular weight of the substance in question when a conversion is being requested from mass to moles/equivalents and vice versa. It is ignored if neither unit includes a measurement in moles. In such cases the mole-based unit must have a single mole unit in the numerator and the mass-based unit must have a single mass unit in the numerator.
  • 'charge' the absolute value of the charge of the substance in question when a conversion is being requested from mass/moles to equivalents and vice versa. It is required when one of the units represents a value in equivalents and the other in mass or moles. It is ignored if neither unit includes an equivalent unit

Returns: a hash with six elements:

  • 'status' the will be: 'succeeded' if the conversion was successfully calculated; 'failed' if the conversion could not be made, e.g., if the units are not commensurable; or 'error' if an error occurred;
  • 'toVal' the numeric value indicating the conversion amount, or null if the conversion failed (e.g., the units are not commensurable);
  • 'msg' is an array of messages, if the string is invalid or an error occurred, indicating the problem, or an explanation of a substitution such as the substitution of 'G' for 'Gauss', or an empty array if no messages were generated;
  • 'suggestions' if suggestions were requested and found, this is a hash that contains at most two elements:
    • 'from' which, if the fromUnitCode input parameter or one or more of its components could not be found, is an array one or more hash objects. Each hash contains three elements:
      • 'msg' which is a message indicating what unit expression the suggestions are for;
      • 'invalidUnit' which is the unit expression the suggestions are for; and
      • 'units' which is an array of data for each suggested unit found. Each array will contain the unit code, the unit name and the unit guidance (if any). If no suggestions were found for the fromUnitCode this element will not be included.
    • 'to' which, if the "to" unit expression or one or more of its components could not be found, is an array one or more hash objects. Each hash contains three elements:
      • 'msg' which is a message indicating what part of the toUnitCode input parameter the suggestions are for;
      • 'invalidUnit' which is the unit expression the suggestions are for; and
      • 'units' which is an array of data for each suggested unit found. Each array will contain the unit code, the unit name and the unit guidance (if any). If no suggestions were found for the toUnitCode this element will not be included. No 'suggestions' element will be included in the returned hash object if none were found, whether or not they were requested.
  • 'fromUnit' the unit object for the fromUnitCode passed in; returned in case it's needed for additional data from the object; and
  • 'toUnit' the unit object for the toUnitCode passed in; returned in case it's needed for additional data from the object.

For example, to convert 27 U.S. fathoms to U.S. inches (assuming you have created a utils object as described above):

var returnObj = utils.convertUnitTo('[fth_us]', 27, '[in_us]');
if (returnObj['status'] === 'succeeded')
  /* the conversion was successful.
     returnObj['toVal'] will contain the conversion result
       (~1943.9999999999998 - number, not formatted string)
     returnObj['msg'] will be null
     returnObj['fromUnit'] will contain the unit object for [fth_us]
     returnObj['toUnit'] will contain the unit object for [in_us]
   */
else if (returnObj['status'] === 'failed')
  /* the conversion could not be made.
     returnObj['toVal'] will be null
     returnObj['msg'] will contain a message describing the failure
     returnObj['fromUnit'] will be null
     returnObj['toUnit'] will be null
   */
else (returnObj['status'] === 'error)
  /* the conversion encountered an error
     returnObj['toVal'] will be null
     returnObj['msg'] will contain a message describing the error
     returnObj['fromUnit'] will be null
     returnObj['toUnit'] will be null
   */

If you want to know what unit types a particular unit can be converted to, the checkSynonyms function will provide a list of commensurable units for a specified unit expression.

checkSynonyms(theSyn)

This method searches for units that include a single search term (theSyn) in the unit's synonyms data and/or the unit name. It returns all units found with a match. This is useful when an exact match for a term is not found. For example, submitting the term "pound" to the validUnitString method will result in a "not found" response. Submitting it to this method will return with a list of possible pound units.

Parameters: 1) theSyn: the term to search for

Returns: a hash with three elements:

  • 'status' contains the status of the request, which can be 'error', 'failed' or 'succeeded';
  • 'msg' contains a message for an error or if no units were found; and
  • 'units' which is an array that contains one hash for each unit found:

    • 'code' is the unit's code;
    • 'name' is the unit's name; and
    • 'guidance' is the guidance, or description, for the unit.

    For example, the 'units' array returned for a search term of "pound" would be:

    • {"code":"[lb_av]","name":"pound - international","guidance":"standard unit used in the US and internationally"}
    • {"code":"[lbf_av]","name":"pound force - US","guidance":"only rarely needed in health care - see [lb_av] which is the more common unit to express weight"}
    • {"code":"[lb_tr]","name":"pound - troy","guidance":"only used for weighing precious metals"}
    • {"code":"[lb_ap]","name":"pound - apothecary","guidance":null}
    • {"code":"[psi]","name":"pound per square inch","guidance":null}

(assuming you have created a utils object as described above):

var returnObj = utils.checkSynonyms('pound');
if (returnObj['status'] === 'succeeded')
  /* one or more units was found.  returnObj['msg'] will be null and the
     returnObj['units'] array will contain the data listed above */
else if (returnObj['status'] === 'failed')
  /* no units were found and the returnObj['msg'] string will indicate that
  */
else
  /* returnObj['status'] will be 'error' and returnObj['msg'] will indicate
     what the error was. */

convertToBaseUnits(fromUnit, fromVal)

Converts the given unit string into its base units, their exponents, and a magnitude, and returns that data.

Parameters: 1) fromUnit: the unit string to be converted to base units information 2) fromVal: the number of "from" units to be converted

Returns: an object with the properties:

  • status: indicates whether the result succeeded. The value will be one of:
    • 'succeeded': the conversion was successfully calculated (which can be true even if it was already in base units);
    • 'invalid': fromUnit is not a valid UCUM code;
    • 'failed': the conversion could not be made (e.g., if it is an "arbitrary" unit);
    • 'error': if an error occurred (an input or programming error)
  • msg: an array of messages (possibly empty), if the string is invalid or
     an error occurred, indicating the problem, or a suggestion of a
     substitution such as the substitution of 'G' for 'Gauss', or
     an empty array if no messages were generated.  There can also be a
     message that is just informational or warning.
  • magnitude: the new value when fromVal units of fromUnits is expressed in the base units.
  • fromUnitIsSpecial: whether the input unit fromUnit is a "special unit"
      as defined in UCUM.  This means there is some function applied to convert
      between fromUnit and the base units, so the returned magnitude is likely not
      useful as a scale factor for other conversions (i.e., it only has validity
      and usefulness for the input values that produced it).
  • unitToExp: a map of base units in fromUnit to their exponent

commensurablesList(fromUnit[, categoryList])

Retrieves a list of units commensurable, i.e., that can be converted from and to, a specified unit. Returns an error if the "from" unit cannot be found. If necessary, you can filter the list of units by specifying a list of unit categories that should be in the resulting list.

Parameters: 1) fromUnit: the name/unit string 2) categoryList: optional parameter - the list of unit categories; possible list values: 'Clinical', 'Nonclinical', 'Obsolete', 'Constant'

Returns: an array containing two elements:

  • 0: an array of commensurable units if any were found, each of which is an object with the properties:
    • name_: unit name;
    • csCode_: unit code;
    • other properties are currently undocumented and their existence should not be relied upon.
  • 1: an error message if the "from" unit is not found.

Download the GitHub repository

The code available here on GitHub includes functions and scripts to perform additional functions, mainly to convert ucum data from various formats to the data used by our code as well as the code that supports the demo page. Click on the green "Code" button above to download the repository.

Building the code and data

If you wish to modify the code, the build process is simply:

npm run build

If you wish to modify or update either of the source data files (ucum-essence.xml or ucum.csv), see impexp/README.md for instructions on build steps for data changes.

changelog

Change Log

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[7.1.3] 2025-05-05

Fixed

  • A unit before/after a parenthesized unit was falsely reported as valid, when suggest=true.

[7.1.2] 2024-12-19

Changed

  • Upgraded to nodejs version 22.

[7.1.1] 2024-10-24

Changed

  • Return "cannot convert" message even if molecular weight and charge fields are provided, if the convert cannot happen between the units.
  • Return both "require molecular weight" and "require charge" messages at the same time, if both are required in convertUnitTo().

[7.1.0] 2024-08-05

Added

  • Published a new API, commensurablesList, to UcumLhcUtils.

[7.0.0] 2024-07-19

Changed

  • Removed bower support
  • Fixed the sourcemap for browser-dist/ucum-lhc.min.js.
  • In the npm package, replace browser-dist/ucum-lhc.js with ucum-lhc.min.js and its sourcemap.

[6.1.1] 2024-07-16

Fixed

  • Removed unneeded dependency.

[6.1.0] 2024-07-12

Added

  • Support for handling eq/mol/mass conversions when there are powers of those units.

[6.0.2] 2024-05-07

Fixed

  • Keep annotation and remove leading "1" in CiCode.

[6.0.1] 2024-05-03

Fixed

  • Validator issue: 2+10 should be invalid.

[6.0.0] 2024-04-25

Changed

  • convertUnitTo now supports specifying the charge of the substance when converting between eq and mol (or eq and g).
  • Specifying the charge when converting between eq and mol (or g) is now required. Previously it assumed the charge is 1, which is not always the case.
  • convertUnitTo now takes an "options" parameter into which the former parameters "suggestions" and "molecularWeight" have been moved, and which contains a new option "charge" for specifying the charge of the substance.
  • Specifying a molecularWeight value when none is needed is no longer treated as an error.

[5.0.4] 2024-03-15

Fixed

  • Validator issue reported on github: m(/s) should be invalid.

[5.0.3] 2024-02-14

Fixed

  • Typos in ucum.csv.

[5.0.2] 2024-02-13

Fixed

  • Validator issues reported on github: g.m2-1 and g.(m2)-1 should be invalid.

[5.0.1] 2024-01-18

Fixed

  • Some of the tags were wrongly closed with <.sup> in ucum-lhc.js.

[5.0.0] 2023-05-26

Changed

  • Breaking change to the new "convertToBaseUnits" API added in 4.2.0: The returned "msg" array can now contain messages even when the conversion is successful. The returned object now also contains a "status" field just like the "convertUnitTo" API.

    Fixed

  • Certain annotation units were marked invalid if the same string existed as a bracketed unit (e.g., {degF} and [degF]). (This fixes the problem raised in https://github.com/lhncbc/ucum-lhc/issues/45.)

[4.2.0] 2023-04-11

Added

  • Added a new API, convertToBaseUnits, to UcumLhcUtils.

    Fixed

  • Added some needed space around symbols in HTML error messages.

[4.1.8] 2023-03-29

Fixed

  • Now validates that characters within annotation strings are in the permitted range.
  • Updated to Node.js 18.

[4.1.7] 2022-12-21

Fixed

  • Units from the data/ucum.csv file, which contains many unit strings with prefixes, were previously permitted to take an additional prefix.
  • Units derived from other units were previously being labeled as "base units", though apparently without ill effect on the current public APIs.

[4.1.6] 2022-09-13

Changed

  • Update version to 4.1.6 for tagging the last merge, which was to update generated files but was not given a new version number and not tagged.

[4.1.5] 2021-05-20

Fixed

[4.1.4] 2021-01-05

Fixed

  • Moved grunt-extract-sourcemap to devDependencies.
  • Updated dependencies to avoid issues raised by npm audit (except one on a devDependency).

[4.1.3] 2020-04-20

Fixed

  • Fixed to work in IE 11.

[4.1.2] 2020-04-03

Changes

  • Updated dependencies to get patches for security vulnerabilities.

[4.1.1] 2020-03-09

Changes

  • removed unnecessary index.html

[4.1.0] 2020-03-05

Changes

  • the sizes of ucumDefs.json and related files reduced

[4.0.2] 2020-03-02

Fixed

  • ucumDefs.json generation: baseFactor_ and magnitude_ should be numbers

    Added

  • added impexp/README.md about generating ucumDef.json

[4.0.1] 2020-02-14

Fixed

  • 4.0.0 was just published today, and is missing a data file in the npm package. This version fixes that.

[4.0.0] 2020-01-27

Changed

  • This main file of the npm package is now a file that uses CommonJS modules (i.e., NodeJs-compatible) instead of a browserified bundle. The problem with serving a browserfied bundle via npm was that if you pulled it in and then tried to browserify it along with application code, an exception would be thrown because browserify has already run on part of the code. The change should be transparent to the user of the package, but just in case there is some unforeseen consequence, I am incrementing the major version. If your application needs the browserified version, that is still available in the browser-dist directory.

[3.0.1] 2020-01-07

Fixed

  • Corrected processing so that strings like "1e2" are no longer considered valid units.

[3.0.0] - 2019-09-26

Fixed

  • Updated dependencies to get patches for security vulnerabilities.
  • Minor corrections to the UCUM data (mostly with regard to extra properties we added like "guidance").

    Changed

  • As result of the dependency update, the build process needed to be revised, and the individual transpiled files were removed. The package.json "main" file has changed. This is not expected to cause a problem for normal usage of the package (relying on the "main" file), and the API has not changed, but due to the upheaval, a semver-major change seemed warranted.

[2.6.4] - 2019-06-05

Fixed

  • Updated dependencies to get patches for security vulnerabilities.

[2.6.3] - 2019-04-29

Fixed

  • Demo page: The validation message on the Validator tab was displayed vertically when the unit was valid.

[2.6.2] - 2019-03-29

Fixed

  • Demo page changes: fixed processing flow problem that allowed an attempt to convert an invalid unit; tweaked flow on initial display of converter tab; added meta data to the page to increase visibility to search engines.

[2.6.1] - 2019-03-22

Added

  • Added mass<-> moles conversion to the UCUM Demo page, with a request to the user to supply a molecular weight when such a conversion is requested.

[2.6.0] - 2019-03-08

Added

  • Added capability to existing convertUnitTo library function to convert mass to moles expression.

[2.5.5] - 2019-02-28

Fixed

  • Fixed mismatches with version numbers as well as problem with library distribution on 2.5.2.

[2.5.2] - 2019-02-05

Fixed

  • Fixed problem with 2.5.0 where not all files were being included in the source-es5/ucumPkg.js package.

[2.5.0] - 2019-01-07

Changed

  • The changes made by browserify have been removed from the ucum-lhc package available to node.js users, necessitating the creation of separate distributions. The distribution of the library code starts at the source-es5/ucumPkg.js file. The distribution in the browser-dist directory contains server side code that includes browser related code. The distribution in the demo-dist directory continues to contain the code related to the UCUM-LHC demo page.

[2.4.4] - 2018-12-13

Fixed

  • fixed bug where validation of a unit string that contains an operator, such as B[10.nV] is a valid string and validates correctly as a single valid UCUM code, but did not validate correctly when preceded by a prefix, e.g., dB[10.nV].

[2.4.3] - 2018-11-06

Fixed

  • fixed bug where validation of a unit string terminated with an operator returned an incorrect response. It correctly flagged the string as an invalid unit expression but included a coding error message that should not have been included.

[2.4.2] - 2018-11-05

Fixed

  • blocked division and multiplication operations as well as conversion operations on arbitrary units

[2.4.1] - 2018-10-25

Added

[2.4.0] - 2018-10-10

Changed

  • redesigned validator tab on Demo page to move messages closer to the unit expression input field
  • redesigned converter tab on Demo page to resemble an equation for the conversion

[2.3.4] - 2018-08-15

Fixed

  • Updated npm packages growl and semver to avoid critical security vulnerabilities flagged by GitHub

[2.3.3] - 2018-08-15

Fixed

  • Updated conversion code to properly handle conversion of unitless measurements, such as moles.
  • Updated code to make text for combined units, e.g., 2.(mmol/L), more explicit in regards to evaluation order.

[2.3.2] - 2018-06-27

Fixed

  • fixed appearance of the demo page converter tab so that when the page is widened in the browser the text all anchors on the left. One portion of the text was anchored to the right, which made a widened version look wrong.

[2.3.1] - 2018-06-13

Fixed

  • modifications to ensure that plain numbers, e.g., 7, are reported correctly.

    Added

  • added unit name to demo output messages, where available, to make sure user knows what unit is being reported as valid.

[2.3.0] - 2018-05-23

Added

  • added information related to version number of the ucum-essence.xml file used as well as changes made to it

[2.2.1] - 2018-05-22

Changed

  • reformatted display of suggestions lists for the demo site to use a bulleted list of suggestions rather than a plain text list.

    Fixed

  • fixed a bug that prevented suggestion lists from being created for more than one unit.

[2.2.0] - 2018-05-02

Changed

  • added list selection listener to unit expression field on validation tab of the demo page

    Fixed

  • fixed autofill problem on Edge browser.

[2.3.4] - 2018-05-?

  • fixed positioning of text on converter tab of the demo page so that it is consistent in how it lines up when the page is widened.

[2.1.12] - 2018-04-26

Changed

  • changed unit name (not code) creation for constructed units to enclose the name in square brackets and use an asterisk (*) for multiplication instead of a period.

[2.1.11] - 2018-04-23

Fixed

  • fix for overwritten units during data update process

[2.1.10] - 2018-04-12

Changed

  • updates to register bower package

[2.1.9] - 2018-04-03

Changed

  • updates to third party and UCUM LHC license information

[2.1.8] - 2018-03-28

Fixed

  • fixes to csv file validator

[2.1.7] - 2018-03-12

Changed

  • cosmetic updates to overview and demo pages related to banner, titles

[2.1.6] - 2018-03-07

Changed

  • created npm package

[2.1.5] - 2018-02-21

Changed

  • shifts module tests to use distribution package
  • moves ucumFileValidator to demo directory
  • updates README

[2.1.4] - 2018-02-16

Changed

  • removes guidance text for constructed units, e.g., units that are created on the fly, as they are specified for validation or conversion. For example, m[H2O]/cm is constructed from m[H2O] (meter of water column) divided by cm (centimeter). No guidance data is provided for this constructed unit.

[2.1.3] - 2018-02-15

Changed

  • added disclaimer concerning conversion results to demo page convert tab and to README.md page

[2.1.2] - 2018-02-15

Fixed

  • completed bug fix for zero and negative number of units for conversions.

[2.1.1] - 2018-01-25

Changed

  • updated link at the top of the demo page to refer back to the overview page - and the link at the top of the overview page to refer back to itself.
  • added text to the demo file validation to clarify that only units are validated. Prefixes on their own are not validated.
  • updated the ucumDefs.json with version 2.1 (November 21, 2017) of the ucum-essence.xml file from unitsofmeasure.org

    Fixed

  • started fixes on a bug where a zero or negative number of units was considered an error.

[2.1.0] - 2017-12-21

Changed

  • Upgraded the validation processing for conversion request on the demo page; validation is now performed on the fly as each element is entered. This is a change only to the demo page.

[2.0.0] - 2017-12-01

Added

  • Added ability to get suggestions for invalid unit expressions.

[1.2.0] - 2017-10-06

Fixed

  • Enhanced unit string validation to accommodate/correct:
    • missing multiplication operators, e.g., 2mg instead of 2.mg;
    • unit name specified instead of ucum code, e.g., day instead of d;
    • misplaced annotations, e.g., {creatine}mol** instead of mol{creatine};
    • missing square brackets, e.g., in_i instead of [in_i]; and
    • braces instead of brackets, e.g., {degF} instead of [degF].

[1.1.2] - 2017-08-07

Changed

  • Updated unit creation process to include updates to case-insensitve codes and print symbol values when creating a unit from multiple units.
  • Updated treatment of prefixes for special units that use conversion functions to record prefix values in the separate conversion prefix field.

[1.1.1] - 2017-07-13

Changed

  • Data file has been updated with enhanced synonyms and is also now written in a a readable JSON format.

[1.1.0] - 2017-07-06

Changed

  • Autocompleters no longer return multiple-unit strings, e.g., kg/cm. Multiple-unit strings are still (very) valid, but the autocompleters just return one list single-unit strings at a time.
  • The commensurables list on the conversion tab's "convert to" field has been changed to just use the same autocompleter as used for the "convert from" field. The list will now include units that cannot be converted.

[1.0.2] - 2017-06-23

Fixed

  • Allowed conversion of units with no dimensions
  • added testing for the Unit.convertFrom and Unit.convertTo functions

[1.0.1] - 2017-05-30

Added

  • This change log.

    Changed

  • Streamlined divString function in Unit.js
  • Moved parenthesized unit string processing to separate function in UnitString.js (processParens).
  • Added testing for the processParens function in testUnitString.spec.js

    Fixed

  • Updated UcumFileValidator.js with previously changed function name (validUnitString -> validateUnitString in UcumLhcUtils.js).