@lhncbc/ucum-lhc 7.1.6 → 7.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"prefixTables.js","names":["PrefixTablesFactory","constructor","byCode_","byValue_","prefixCount","Object","keys","length","allPrefixesByValue","prefixBuff","pList","pLen","p","pfx","getPrefixByValue","code_","name_","value_","allPrefixesByCode","prefixList","sort","push","getPrefixByCode","add","prefixObj","getCode","getValue","isDefined","code","undefined","value","exports","prefixTablesInstance","PrefixTables","getInstance"],"sources":["../source/prefixTables.js"],"sourcesContent":["/**\n * The tables of defined prefixes is defined in this file.\n */\n\n/**\n * This class implements the table of multiplier prefixes.\n *\n * @author Lee Mericle, based on java version by Gunther Schadow\n *\n */\nexport class PrefixTablesFactory {\n\n /**\n * Constructor. This creates the empty PrefixTable hashes once.\n * There is one hash whose key is the prefix code and one whose\n * key is the prefix value.\n *\n * Implementation of this as a singleton is based on the UnitTables\n * implementation. See that class for details.\n */\n constructor(){\n this.byCode_ = {} ;\n this.byValue_ = {};\n }\n\n\n /**\n * Provides the number of prefix objects in each table\n * @returns count of the number of prefix objects in each table\n */\n prefixCount() {\n return Object.keys(this.byCode_).length ;\n }\n\n\n /**\n * This is used to get all prefix objects by value. Currently it is used\n * to create a csv file with all prefixes and units.\n * @returns csv string containing all prefix objects, ordered by value.\n */\n allPrefixesByValue() {\n let prefixBuff = '';\n let pList = Object.keys(this.byValue_);\n //pList.sort() ;\n let pLen = pList.length;\n for (let p = 0; p < pLen; p++) {\n let pfx = this.getPrefixByValue(pList[p]) ;\n prefixBuff += pfx.code_ + ',' + pfx.name_ + ',,' + pfx.value_ + '\\r\\n';\n }\n return prefixBuff ;\n }\n\n /**\n * This is used to get all prefix objects. Currently it is used\n * to get the objects to write to the json ucum definitions file\n * that is used to provide prefix and unit definition objects for\n * conversions and validations.\n *\n * @returns an array containing all prefix objects, ordered by code.\n */\n allPrefixesByCode() {\n let prefixList = [];\n let pList = Object.keys(this.byCode_);\n pList.sort() ;\n let pLen = pList.length;\n for (let p = 0; p < pLen; p++) {\n prefixList.push(this.getPrefixByCode(pList[p])) ;\n }\n return prefixList ;\n }\n\n /**\n * Adds a prefix object to the tables\n *\n * @param prefixObj the object to be added to the tables\n */\n add(prefixObj){\n this.byCode_[prefixObj.getCode()] = prefixObj;\n this.byValue_[prefixObj.getValue()] = prefixObj;\n }\n\n\n /**\n * Tests whether a prefix object is found for a specified code. This\n * is used to determine whether or not a prefix object has been created\n * for the code.\n *\n * @param code the code to be used to find the prefix object\n * @return boolean indicating whether or not a prefix object was found\n * for the specified code\n */\n isDefined(code) {\n return this.byCode_[code] !== null && this.byCode_[code] !== undefined ;\n }\n\n\n /**\n * Obtains a prefix object for a specified code.\n *\n * @param code the code to be used to find the prefix object\n * @return the prefix object found, or null if nothing was found\n */\n getPrefixByCode(code) {\n return this.byCode_[code];\n }\n\n\n /**\n * Obtains a prefix object for a specified value.\n *\n * @param value the value to be used to find the prefix object\n * @return the prefix object found, or null if nothing was found\n */\n getPrefixByValue(value) {\n return this.byValue_[value];\n }\n\n} // end PrefixTablesFactory class\n\n\n// Create a singleton instance and (to preserve the existing API) an object that\n// provides that instance via getInstance().\nvar prefixTablesInstance = new PrefixTablesFactory();\nexport const PrefixTables = {\n getInstance: function() {\n return prefixTablesInstance;\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,CAAC;EAE/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAAA,EAAE;IACX,IAAI,CAACC,OAAO,GAAG,CAAC,CAAC;IACjB,IAAI,CAACC,QAAQ,GAAG,CAAC,CAAC;EACpB;;EAGA;AACF;AACA;AACA;EACEC,WAAWA,CAAA,EAAG;IACZ,OAAOC,MAAM,CAACC,IAAI,CAAC,IAAI,CAACJ,OAAO,CAAC,CAACK,MAAM;EACzC;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S;EACjD;;EAGA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEG,SAASA,CAACC,IAAI,EAAE;IACd,OAAO,IAAI,CAAC1B,OAAO,CAAC0B,IAAI,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC1B,OAAO,CAAC0B,IAAI,CAAC,KAAKC,SAAS;EACxE;;EAGA;AACF;AACA;AACA;AACA;AACA;EACEP,eAAeA,CAACM,IAAI,EAAE;IACpB,OAAO,IAAI,CAAC1B,OAAO,CAAC0B,IAAI,CAAC;EAC3B;;EAGA;AACF;AACA;AACA;AACA;AACA;EACEd,gBAAgBA,CAACgB,KAAK,EAAE;IACtB,OAAO,IAAI,CAAC3B,QAAQ,CAAC2B,KAAK,CAAC;EAC7B;AAEF,CAAC,CAAC;;AAGF;AACA;AAAAC,OAAA,CAAA/B,mBAAA,GAAAA,mBAAA;AACA,IAAIgC,oBAAoB,GAAG,IAAIhC,mBAAmB,CAAC,CAAC;AAC7C,MAAMiC,YAAY,GAAG;EAC1BC,WAAW,EAAE,SAAAA,CAAA,EAAW;IACtB,OAAOF,oBAAoB;EAC7B;AACF,CAAC;AAAAD,OAAA,CAAAE,YAAA,GAAAA,YAAA","ignoreList":[]}
1
+ {"version":3,"file":"prefixTables.js","names":["PrefixTablesFactory","constructor","byCode_","byValue_","prefixCount","Object","keys","length","allPrefixesByValue","prefixBuff","pList","pLen","p","pfx","getPrefixByValue","code_","name_","value_","allPrefixesByCode","prefixList","sort","push","getPrefixByCode","add","prefixObj","getCode","getValue","isDefined","code","undefined","value","exports","prefixTablesInstance","PrefixTables","getInstance"],"sources":["../source/prefixTables.js"],"sourcesContent":["/**\n * The tables of defined prefixes is defined in this file.\n */\n\n/**\n * This class implements the table of multiplier prefixes.\n *\n * @author Lee Mericle, based on java version by Gunther Schadow\n *\n */\nexport class PrefixTablesFactory {\n\n /**\n * Constructor. This creates the empty PrefixTable hashes once.\n * There is one hash whose key is the prefix code and one whose\n * key is the prefix value.\n *\n * Implementation of this as a singleton is based on the UnitTables\n * implementation. See that class for details.\n */\n constructor(){\n this.byCode_ = {} ;\n this.byValue_ = {};\n }\n\n\n /**\n * Provides the number of prefix objects in each table\n * @returns count of the number of prefix objects in each table\n */\n prefixCount() {\n return Object.keys(this.byCode_).length ;\n }\n\n\n /**\n * This is used to get all prefix objects by value. Currently it is used\n * to create a csv file with all prefixes and units.\n * @returns csv string containing all prefix objects, ordered by value.\n */\n allPrefixesByValue() {\n let prefixBuff = '';\n let pList = Object.keys(this.byValue_);\n //pList.sort() ;\n let pLen = pList.length;\n for (let p = 0; p < pLen; p++) {\n let pfx = this.getPrefixByValue(pList[p]) ;\n prefixBuff += pfx.code_ + ',' + pfx.name_ + ',,' + pfx.value_ + '\\r\\n';\n }\n return prefixBuff ;\n }\n\n /**\n * This is used to get all prefix objects. Currently it is used\n * to get the objects to write to the json ucum definitions file\n * that is used to provide prefix and unit definition objects for\n * conversions and validations.\n *\n * @returns an array containing all prefix objects, ordered by code.\n */\n allPrefixesByCode() {\n let prefixList = [];\n let pList = Object.keys(this.byCode_);\n pList.sort() ;\n let pLen = pList.length;\n for (let p = 0; p < pLen; p++) {\n prefixList.push(this.getPrefixByCode(pList[p])) ;\n }\n return prefixList ;\n }\n\n /**\n * Adds a prefix object to the tables\n *\n * @param prefixObj the object to be added to the tables\n */\n add(prefixObj){\n this.byCode_[prefixObj.getCode()] = prefixObj;\n this.byValue_[prefixObj.getValue()] = prefixObj;\n }\n\n\n /**\n * Tests whether a prefix object is found for a specified code. This\n * is used to determine whether or not a prefix object has been created\n * for the code.\n *\n * @param code the code to be used to find the prefix object\n * @return boolean indicating whether or not a prefix object was found\n * for the specified code\n */\n isDefined(code) {\n return this.byCode_[code] !== null && this.byCode_[code] !== undefined ;\n }\n\n\n /**\n * Obtains a prefix object for a specified code.\n *\n * @param code the code to be used to find the prefix object\n * @return the prefix object found, or null if nothing was found\n */\n getPrefixByCode(code) {\n return this.byCode_[code];\n }\n\n\n /**\n * Obtains a prefix object for a specified value.\n *\n * @param value the value to be used to find the prefix object\n * @return the prefix object found, or null if nothing was found\n */\n getPrefixByValue(value) {\n return this.byValue_[value];\n }\n\n} // end PrefixTablesFactory class\n\n\n// Create a singleton instance and (to preserve the existing API) an object that\n// provides that instance via getInstance().\nvar prefixTablesInstance = new PrefixTablesFactory();\nexport const PrefixTables = {\n getInstance: function() {\n return prefixTablesInstance;\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,CAAC;EAE/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAAA,EAAE;IACX,IAAI,CAACC,OAAO,GAAG,CAAC,CAAC;IACjB,IAAI,CAACC,QAAQ,GAAG,CAAC,CAAC;EACpB;;EAGA;AACF;AACA;AACA;EACEC,WAAWA,CAAA,EAAG;IACZ,OAAOC,MAAM,CAACC,IAAI,CAAC,IAAI,CAACJ,OAAO,CAAC,CAACK,MAAM;EACzC;;EAGA;AACF;AACA;AACA;AACA;EACEC,kBAAkBA,CAAA,EAAG;IACnB,IAAIC,UAAU,GAAG,EAAE;IACnB,IAAIC,KAAK,GAAGL,MAAM,CAACC,IAAI,CAAC,IAAI,CAACH,QAAQ,CAAC;IACtC;IACA,IAAIQ,IAAI,GAAGD,KAAK,CAACH,MAAM;IACvB,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,IAAI,EAAEC,CAAC,EAAE,EAAE;MAC7B,IAAIC,GAAG,GAAG,IAAI,CAACC,gBAAgB,CAACJ,KAAK,CAACE,CAAC,CAAC,CAAC;MACzCH,UAAU,IAAII,GAAG,CAACE,KAAK,GAAG,GAAG,GAAGF,GAAG,CAACG,KAAK,GAAG,IAAI,GAAGH,GAAG,CAACI,MAAM,GAAG,MAAM;IACxE;IACA,OAAOR,UAAU;EACnB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACES,iBAAiBA,CAAA,EAAG;IACl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YAAY,GAAAF,OAAA,CAAAE,YAAA,GAAG;EAC1BC,WAAW,EAAE,SAAAA,CAAA,EAAW;IACtB,OAAOF,oBAAoB;EAC7B;AACF,CAAC","ignoreList":[]}
@@ -229,6 +229,5 @@ class UcumFunctions {
229
229
  return this.funcs[fname] !== null;
230
230
  }
231
231
  } // end of UcumFunctions class
232
- var _default = new UcumFunctions(); // one singleton instance
233
- exports.default = _default;
232
+ var _default = exports.default = new UcumFunctions(); // one singleton instance
234
233
  //# sourceMappingURL=ucumFunctions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ucumFunctions.js","names":["UcumFunctions","constructor","funcs","cnvTo","x","cnvFrom","Math","log","LN10","pow","exp","LN2","tan","atan","sqrt","func","forName","fname","toLowerCase","f","Error","isDefined","_default","exports","default"],"sources":["../source/ucumFunctions.js"],"sourcesContent":["/*\n * This class manages the special functions used by some units.\n *\n * @author Lee Mericle, based on java version by Gunther Schadow\n *\n */\n\nclass UcumFunctions {\n\n /**\n * Constructor\n *\n * Creates the singleton object that contains the list of functions used\n * to convert special units.\n */\n constructor() {\n\n // Create the hash containing the function pairs\n this.funcs = {};\n\n // Celsius - convert to Celsius from kelvin and from Celsius to kelvin\n // where kelvin is the base unit for temperature\n this.funcs['cel'] = {cnvTo : function(x){return x - 273.15;},\n cnvFrom : function(x){return x + 273.15;}};\n\n // Fahrenheit - convert to Fahrenheit from kelvin and from Fahrenheit to\n // kelvin - which is the base unit for temperature\n this.funcs['degf'] = {cnvTo : function(x){return x - 459.67;},\n cnvFrom : function(x){return x + 459.67;}};\n\n // Reaumur - convert between Reaumur and Kelvin. Because of the way the\n // calling code in the Units class is set up (in the convertFrom method),\n // what is given here as the convertTo function is actually the convert\n // from method and vice versa.\n //this.funcs['degre'] = {cnvTo : function(x){return x + 273.15;},\n // cnvFrom : function(x){return x - 273.15;}};\n this.funcs['degre'] = {cnvTo : function(x){return x - 273.15;},\n cnvFrom : function(x){return x + 273.15;}};\n\n // pH - convert to pH from moles per liter and from moles per liter to pH\n // where a mole is an amount of a substance (a count of particles)\n this.funcs['ph'] = {cnvTo : function(x){return - Math.log(x) / Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, -x);}};\n\n // ln - natural logarithm (base e 2.71828) - apply (cnvTo) and invert (cnvFrom)\n // and 2ln - two times the natural logarithm\n this.funcs['ln'] = {cnvTo : function(x){return Math.log(x);},\n cnvFrom : function(x){return Math.exp(x);}};\n this.funcs['2ln'] = {cnvTo : function(x){return 2 * Math.log(x);},\n cnvFrom : function(x){return Math.exp(x / 2);}};\n\n // lg - the decadic logarithm (base 10)\n this.funcs['lg'] = {cnvTo : function(x){return Math.log(x) / Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x);}};\n this.funcs['10lg'] = {cnvTo : function(x){return 10 * Math.log(x)/Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x / 10);}};\n this.funcs['20lg'] = {cnvTo : function(x){return 20 * Math.log(x)/Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x / 20);}};\n // The plain text ucum units file uses '2lg'\n this.funcs['2lg'] = {cnvTo : function(x){return 2 * Math.log(x)/Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x / 2);}};\n // The xml essence ucum file uses lgTimes2\n this.funcs['lgtimes2'] = this.funcs['2lg'];\n\n // ld - dual logarithm (base 2)\n this.funcs['ld'] = {cnvTo : function(x){return Math.log(x)/Math.LN2;},\n cnvFrom : function(x){return Math.pow(2, x);}};\n\n // tan - tangent\n this.funcs['100tan'] = {cnvTo : function(x){return Math.tan(x) * 100;},\n cnvFrom : function(x){return Math.atan(x/100);}};\n // the xml essence ucum file uses both 100tan and tanTimes100\n this.funcs['tanTimes100'] = this.funcs['100tan'] ;\n\n // sqrt - square root\n this.funcs['sqrt'] = {cnvTo : function(x){return Math.sqrt(x);},\n cnvFrom : function(x){return x*x;}};\n\n // inv - inverse\n this.funcs['inv'] = {cnvTo : function(x){return 1.0 / x;},\n cnvFrom : function(x){return 1.0 / x;}};\n\n // homeopathic potency functions\n this.funcs['hpX'] = {cnvTo : function(x){return -(this.funcs['lg'](x));},\n cnvFrom : function(x){return Math.pow(10, -x);}};\n\n this.funcs['hpC'] = {cnvTo : function(x){\n return -(this.func['ln'](x))/this.funcs['ln'](100);},\n cnvFrom : function(x){return Math.pow(100, -x);}};\n\n this.funcs['hpM'] = {cnvTo : function(x){\n return -(this.funcs['ln'](x))/this.funcs['ln'](1000);},\n cnvFrom : function(x){return Math.pow(1000, -x);}};\n\n this.funcs['hpQ'] = {cnvTo : function(x){\n return -(this.funcs['ln'](x))/this.funcs['ln'](50000);},\n cnvFrom : function(x){return Math.pow(50000, -x);}};\n\n } // end of constructor\n\n\n /**\n * Returns the function with the name specified\n *\n * @param fname name of the function to be returned\n * @return the function with the specified name\n * @throws an error message if the function is not found\n */\n forName(fname) {\n fname = fname.toLowerCase();\n\n let f = this.funcs[fname] ;\n if (f === null)\n throw(new Error(`Requested function ${fname} is not defined`));\n return f;\n }\n\n\n /**\n * Returns a flag indicating whether or not the function has been\n * defined.\n *\n * @param fname name of the function in question\n * @return true if it has been defined; false if not\n */\n isDefined(fname) {\n fname = fname.toLowerCase();\n return this.funcs[fname] !== null;\n }\n\n} // end of UcumFunctions class\n\nexport default new UcumFunctions(); // one singleton instance\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,aAAa,CAAC;EAElB;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAAA,EAAG;IAEZ;IACA,IAAI,CAACC,KAAK,GAAG,CAAC,CAAC;;IAEf;IACA;IACA,IAAI,CAACA,KAAK,CAAC,KAAK,CAAC,GAAG;MAACC,KAAK,EAAK,SAAAA,CAASC,CAAC,EAAC;QAAC,OAAOA,CAAC,GAAG,MAAM;MAAC,CAAC;MAC5CC,OAAO,EAAG,SAAAA,CAASD,CAAC,EAAC;QAAC,OAAOA,CAAC,GAAG,MAAM;MAAC;IAAC,CAAC;;IAE5D;IACA;IACA,IAAI,CA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AACG,GAAG,CAAC,IAAI,EAAE,CAACL,CAAC,CAAC;MAAC;IAAC,CAAC;IAEpE,IAAI,CAACF,KAAK,CAAC,KAAK,CAAC,GAAG;MAACC,KAAK,EAAG,SAAAA,CAASC,CAAC,EAAC;QACd,OAAO,CAAE,IAAI,CAACF,KAAK,CAAC,IAAI,CAAC,CAACE,CAAC,CAAE,GAAC,IAAI,CAACF,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;MAAC,CAAC;MAC/DG,OAAO,EAAG,SAAAA,CAASD,CAAC,EAAC;QAAC,OAAOE,IAAI,CAACG,GAAG,CAAC,KAAK,EAAE,CAACL,CAAC,CAAC;MAAC;IAAC,CAAC;EAEvE,CAAC,CAAC;;EAGF;AACF;AACA;AACA;AACA;AACA;AACA;EACEY,OAAOA,CAACC,KAAK,EAAE;IACbA,KAAK,GAAGA,KAAK,CAACC,WAAW,CAAC,CAAC;IAE3B,IAAIC,CAAC,GAAG,IAAI,CAACjB,KAAK,CAACe,KAAK,CAAC;IACzB,IAAIE,CAAC,KAAK,IAAI,EACZ,MAAM,IAAIC,KAAK,CAAE,sBAAqBH,KAAM,iBAAgB,CAAC;IAC/D,OAAOE,CAAC;EACV;;EAGA;AACF;AACA;AACA;AACA;AACA;AACA;EACEE,SAASA,CAACJ,KAAK,EAAE;IACfA,KAAK,GAAGA,KAAK,CAACC,WAAW,CAAC,CAAC;IAC3B,OAAO,IAAI,CAAChB,KAAK,CAACe,KAAK,CAAC,KAAK,IAAI;EACnC;AAEF,CAAC,CAAC;AAAA,IAAAK,QAAA,GAEa,IAAItB,aAAa,CAAC,CAAC,EAAE;AAAAuB,OAAA,CAAAC,OAAA,GAAAF,QAAA","ignoreList":[]}
1
+ {"version":3,"file":"ucumFunctions.js","names":["UcumFunctions","constructor","funcs","cnvTo","x","cnvFrom","Math","log","LN10","pow","exp","LN2","tan","atan","sqrt","func","forName","fname","toLowerCase","f","Error","isDefined","_default","exports","default"],"sources":["../source/ucumFunctions.js"],"sourcesContent":["/*\n * This class manages the special functions used by some units.\n *\n * @author Lee Mericle, based on java version by Gunther Schadow\n *\n */\n\nclass UcumFunctions {\n\n /**\n * Constructor\n *\n * Creates the singleton object that contains the list of functions used\n * to convert special units.\n */\n constructor() {\n\n // Create the hash containing the function pairs\n this.funcs = {};\n\n // Celsius - convert to Celsius from kelvin and from Celsius to kelvin\n // where kelvin is the base unit for temperature\n this.funcs['cel'] = {cnvTo : function(x){return x - 273.15;},\n cnvFrom : function(x){return x + 273.15;}};\n\n // Fahrenheit - convert to Fahrenheit from kelvin and from Fahrenheit to\n // kelvin - which is the base unit for temperature\n this.funcs['degf'] = {cnvTo : function(x){return x - 459.67;},\n cnvFrom : function(x){return x + 459.67;}};\n\n // Reaumur - convert between Reaumur and Kelvin. Because of the way the\n // calling code in the Units class is set up (in the convertFrom method),\n // what is given here as the convertTo function is actually the convert\n // from method and vice versa.\n //this.funcs['degre'] = {cnvTo : function(x){return x + 273.15;},\n // cnvFrom : function(x){return x - 273.15;}};\n this.funcs['degre'] = {cnvTo : function(x){return x - 273.15;},\n cnvFrom : function(x){return x + 273.15;}};\n\n // pH - convert to pH from moles per liter and from moles per liter to pH\n // where a mole is an amount of a substance (a count of particles)\n this.funcs['ph'] = {cnvTo : function(x){return - Math.log(x) / Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, -x);}};\n\n // ln - natural logarithm (base e 2.71828) - apply (cnvTo) and invert (cnvFrom)\n // and 2ln - two times the natural logarithm\n this.funcs['ln'] = {cnvTo : function(x){return Math.log(x);},\n cnvFrom : function(x){return Math.exp(x);}};\n this.funcs['2ln'] = {cnvTo : function(x){return 2 * Math.log(x);},\n cnvFrom : function(x){return Math.exp(x / 2);}};\n\n // lg - the decadic logarithm (base 10)\n this.funcs['lg'] = {cnvTo : function(x){return Math.log(x) / Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x);}};\n this.funcs['10lg'] = {cnvTo : function(x){return 10 * Math.log(x)/Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x / 10);}};\n this.funcs['20lg'] = {cnvTo : function(x){return 20 * Math.log(x)/Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x / 20);}};\n // The plain text ucum units file uses '2lg'\n this.funcs['2lg'] = {cnvTo : function(x){return 2 * Math.log(x)/Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x / 2);}};\n // The xml essence ucum file uses lgTimes2\n this.funcs['lgtimes2'] = this.funcs['2lg'];\n\n // ld - dual logarithm (base 2)\n this.funcs['ld'] = {cnvTo : function(x){return Math.log(x)/Math.LN2;},\n cnvFrom : function(x){return Math.pow(2, x);}};\n\n // tan - tangent\n this.funcs['100tan'] = {cnvTo : function(x){return Math.tan(x) * 100;},\n cnvFrom : function(x){return Math.atan(x/100);}};\n // the xml essence ucum file uses both 100tan and tanTimes100\n this.funcs['tanTimes100'] = this.funcs['100tan'] ;\n\n // sqrt - square root\n this.funcs['sqrt'] = {cnvTo : function(x){return Math.sqrt(x);},\n cnvFrom : function(x){return x*x;}};\n\n // inv - inverse\n this.funcs['inv'] = {cnvTo : function(x){return 1.0 / x;},\n cnvFrom : function(x){return 1.0 / x;}};\n\n // homeopathic potency functions\n this.funcs['hpX'] = {cnvTo : function(x){return -(this.funcs['lg'](x));},\n cnvFrom : function(x){return Math.pow(10, -x);}};\n\n this.funcs['hpC'] = {cnvTo : function(x){\n return -(this.func['ln'](x))/this.funcs['ln'](100);},\n cnvFrom : function(x){return Math.pow(100, -x);}};\n\n this.funcs['hpM'] = {cnvTo : function(x){\n return -(this.funcs['ln'](x))/this.funcs['ln'](1000);},\n cnvFrom : function(x){return Math.pow(1000, -x);}};\n\n this.funcs['hpQ'] = {cnvTo : function(x){\n return -(this.funcs['ln'](x))/this.funcs['ln'](50000);},\n cnvFrom : function(x){return Math.pow(50000, -x);}};\n\n } // end of constructor\n\n\n /**\n * Returns the function with the name specified\n *\n * @param fname name of the function to be returned\n * @return the function with the specified name\n * @throws an error message if the function is not found\n */\n forName(fname) {\n fname = fname.toLowerCase();\n\n let f = this.funcs[fname] ;\n if (f === null)\n throw(new Error(`Requested function ${fname} is not defined`));\n return f;\n }\n\n\n /**\n * Returns a flag indicating whether or not the function has been\n * defined.\n *\n * @param fname name of the function in question\n * @return true if it has been defined; false if not\n */\n isDefined(fname) {\n fname = fname.toLowerCase();\n return this.funcs[fname] !== null;\n }\n\n} // end of UcumFunctions class\n\nexport default new UcumFunctions(); // one singleton instance\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,aAAa,CAAC;EAElB;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAAA,EAAG;IAEZ;IACA,IAAI,CAACC,KAAK,GAAG,CAAC,CAAC;;IAEf;IACA;IACA,IAAI,CAACA,KAAK,CAAC,KAAK,CAAC,GAAG;MAACC,KAAK,EAAK,SAAAA,CAASC,CAAC,EAAC;QAAC,OAAOA,CAAC,GAAG,MAAM;MAAC,CAAC;MAC5CC,OAAO,EAAG,SAAAA,CAASD,CAAC,EAAC;QAAC,OAAOA,CAAC,GAAG,MAAM;MAAC;IAAC,CAAC;;IAE5D;IACA;IACA,IAAI,CAACF,KAAK,CAAC,MAAM,CAAC,GAAG;MAACC,KAAK,EAAK,SAAAA,CAASC,CAAC,EAAC;QAAC,OAAOA,CAAC,GAAG,MAAM;MAAC,CAAC;MAC5CC,OAAO,EAAG,SAAAA,CAASD,CAAC,EAAC;QAAC,OAAOA,CAAC,GAAG,MAAM;MAAC;IAAC,CAAC;;IAE7D;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,CAACF,KAAK,CAAC,OAAO,CAAC,GAAG;MAACC,KAAK,EAAK,SAAAA,CAASC,CAAC,EAAC;QAAC,OAAOA,CAAC,GAAG,MAAM;MAAC,CAAC;MAC5CC,OAAO,EAAG,SAAAA,CAASD,CAAC,EAAC;QAAC,OAAOA,CAAC,GAAG,MAAM;MAAC;IAAC,CAAC;;IAE9D;IACA;IACA,IAAI,CAACF,KAAK,C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AAE;IACbA,KAAK,GAAGA,KAAK,CAACC,WAAW,CAAC,CAAC;IAE3B,IAAIC,CAAC,GAAG,IAAI,CAACjB,KAAK,CAACe,KAAK,CAAC;IACzB,IAAIE,CAAC,KAAK,IAAI,EACZ,MAAM,IAAIC,KAAK,CAAC,sBAAsBH,KAAK,iBAAiB,CAAC;IAC/D,OAAOE,CAAC;EACV;;EAGA;AACF;AACA;AACA;AACA;AACA;AACA;EACEE,SAASA,CAACJ,KAAK,EAAE;IACfA,KAAK,GAAGA,KAAK,CAACC,WAAW,CAAC,CAAC;IAC3B,OAAO,IAAI,CAAChB,KAAK,CAACe,KAAK,CAAC,KAAK,IAAI;EACnC;AAEF,CAAC,CAAC;AAAA,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa,IAAIxB,aAAa,CAAC,CAAC,EAAE","ignoreList":[]}
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isNumericString = isNumericString;
7
- exports.isIntegerUnit = isIntegerUnit;
8
6
  exports.getSynonyms = getSynonyms;
7
+ exports.isIntegerUnit = isIntegerUnit;
8
+ exports.isNumericString = isNumericString;
9
9
  /**
10
10
  * Internal utilities used by multiple UCUM classes. For example,
11
11
  * isNumericString is used by both the UnitString and UcumLhcUtils
@@ -48,6 +48,5 @@ class UcumJsonDefs {
48
48
  } // end loadJsonDefs
49
49
  } // end UcumJsonDefs class
50
50
  exports.UcumJsonDefs = UcumJsonDefs;
51
- var ucumJsonDefs = new UcumJsonDefs();
52
- exports.ucumJsonDefs = ucumJsonDefs;
51
+ var ucumJsonDefs = exports.ucumJsonDefs = new UcumJsonDefs();
53
52
  //# sourceMappingURL=ucumJsonDefs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ucumJsonDefs.js","names":["Pfx","require","PfxT","Un","Utab","unpackArray","UcumJsonDefs","loadJsonDefs","jsonDefs","prefixes","units","UnitTables","getInstance","unitsCount","pTab","PrefixTables","plen","length","p","newPref","Prefix","add","uTab","ulen","u","newUnit","Unit","addUnit","exports","ucumJsonDefs"],"sources":["../source/ucumJsonDefs.js"],"sourcesContent":["/**\n * This class handles opening, reading and loading the JSON file of ucum\n * definitions (prefixes, base units, and unit atoms).\n *\n * @author Lee Mericle\n *\n */\n\nvar Pfx = require(\"./prefix.js\");\nvar PfxT = require(\"./prefixTables.js\");\nvar Un = require(\"./unit.js\");\nvar Utab = require('./unitTables.js');\nvar unpackArray = require('./jsonArrayPack.js').unpackArray;\n\nexport class UcumJsonDefs {\n\n /**\n * This method loads the JSON prefix and unit objects into the prefix and\n * unit tables.\n *\n * @returns nothing\n */\n loadJsonDefs() {\n // requiring the file will take care of opening it for use\n const jsonDefs = require('../data/ucumDefs.min.json');\n jsonDefs.prefixes = unpackArray(jsonDefs.prefixes);\n jsonDefs.units = unpackArray(jsonDefs.units);\n\n if (Utab.UnitTables.getInstance().unitsCount() === 0) {\n\n let pTab = PfxT.PrefixTables.getInstance();\n let prefixes = jsonDefs[\"prefixes\"];\n let plen = prefixes.length;\n\n for (let p = 0; p < plen; p++) {\n let newPref = new Pfx.Prefix(prefixes[p]);\n pTab.add(newPref);\n }\n\n let uTab = Utab.UnitTables.getInstance();\n let units = jsonDefs[\"units\"];\n let ulen = units.length;\n\n for (let u = 0; u < ulen; u++) {\n let newUnit = new Un.Unit(units[u]);\n uTab.addUnit(newUnit);\n }\n } // end if the data has not already been loaded\n } // end loadJsonDefs\n\n} // end UcumJsonDefs class\n\nvar ucumJsonDefs = new UcumJsonDefs();\nexport {ucumJsonDefs};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIA,GAAG,GAAGC,OAAO,CAAC,aAAa,CAAC;AAChC,IAAIC,IAAI,GAAGD,OAAO,CAAC,mBAAmB,CAAC;AACvC,IAAIE,EAAE,GAAGF,OAAO,CAAC,WAAW,CAAC;AAC7B,IAAIG,IAAI,GAAGH,OAAO,CAAC,iBAAiB,C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AACF,OAAO,CAAC;MACvB;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AAEJ,CAAC,CAAC;AAAAG,OAAA,CAAAtB,YAAA,GAAAA,YAAA;AAEF,IAAIuB,YAAY,GAAG,IAAIvB,YAAY,CAAC,CAAC;AAACsB,OAAA,CAAAC,YAAA,GAAAA,YAAA","ignoreList":[]}
1
+ {"version":3,"file":"ucumJsonDefs.js","names":["Pfx","require","PfxT","Un","Utab","unpackArray","UcumJsonDefs","loadJsonDefs","jsonDefs","prefixes","units","UnitTables","getInstance","unitsCount","pTab","PrefixTables","plen","length","p","newPref","Prefix","add","uTab","ulen","u","newUnit","Unit","addUnit","exports","ucumJsonDefs"],"sources":["../source/ucumJsonDefs.js"],"sourcesContent":["/**\n * This class handles opening, reading and loading the JSON file of ucum\n * definitions (prefixes, base units, and unit atoms).\n *\n * @author Lee Mericle\n *\n */\n\nvar Pfx = require(\"./prefix.js\");\nvar PfxT = require(\"./prefixTables.js\");\nvar Un = require(\"./unit.js\");\nvar Utab = require('./unitTables.js');\nvar unpackArray = require('./jsonArrayPack.js').unpackArray;\n\nexport class UcumJsonDefs {\n\n /**\n * This method loads the JSON prefix and unit objects into the prefix and\n * unit tables.\n *\n * @returns nothing\n */\n loadJsonDefs() {\n // requiring the file will take care of opening it for use\n const jsonDefs = require('../data/ucumDefs.min.json');\n jsonDefs.prefixes = unpackArray(jsonDefs.prefixes);\n jsonDefs.units = unpackArray(jsonDefs.units);\n\n if (Utab.UnitTables.getInstance().unitsCount() === 0) {\n\n let pTab = PfxT.PrefixTables.getInstance();\n let prefixes = jsonDefs[\"prefixes\"];\n let plen = prefixes.length;\n\n for (let p = 0; p < plen; p++) {\n let newPref = new Pfx.Prefix(prefixes[p]);\n pTab.add(newPref);\n }\n\n let uTab = Utab.UnitTables.getInstance();\n let units = jsonDefs[\"units\"];\n let ulen = units.length;\n\n for (let u = 0; u < ulen; u++) {\n let newUnit = new Un.Unit(units[u]);\n uTab.addUnit(newUnit);\n }\n } // end if the data has not already been loaded\n } // end loadJsonDefs\n\n} // end UcumJsonDefs class\n\nvar ucumJsonDefs = new UcumJsonDefs();\nexport {ucumJsonDefs};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIA,GAAG,GAAGC,OAAO,CAAC,aAAa,CAAC;AAChC,IAAIC,IAAI,GAAGD,OAAO,CAAC,mBAAmB,CAAC;AACvC,IAAIE,EAAE,GAAGF,OAAO,CAAC,WAAW,CAAC;AAC7B,IAAIG,IAAI,GAAGH,OAAO,CAAC,iBAAiB,CAAC;AACrC,IAAII,WAAW,GAAGJ,OAAO,CAAC,oBAAoB,CAAC,CAACI,WAAW;AAEpD,MAAMC,YAAY,CAAC;EAExB;AACF;AACA;AACA;AACA;AACA;EACEC,YAAYA,CAAA,EAAG;IACb;IACA,MAAMC,QAAQ,GAAGP,OAAO,CAAC,2BAA2B,CAAC;IACrDO,QAAQ,CAACC,QAAQ,GAAGJ,WAAW,CAACG,QAAQ,CAACC,QAAQ,CAAC;IAClDD,QAAQ,CAACE,KAAK,GAAGL,WAAW,CAACG,QAAQ,CAACE,KAAK,CAAC;IAE5C,IAAIN,IAAI,CAACO,UAAU,CAACC,WAAW,CAAC,CAAC,CAACC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE;MAEpD,IAAIC,IAAI,GAAGZ,IAAI,CAACa,YAAY,CAACH,WAAW,CAAC,CAAC;MAC1C,IAAIH,QAAQ,GAAGD,QAAQ,CAAC,UAAU,CAAC;MACnC,IAAIQ,IAAI,GAAGP,QAAQ,CAACQ,MAAM;MAE1B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,IAAI,EAAEE,CAAC,EAAE,EAAE;QAC7B,IAAIC,OAAO,GAAG,IAAInB,GAAG,CAACoB,MAAM,CAACX,QAAQ,CAACS,CAAC,CAAC,CAAC;QACzCJ,IAAI,CAACO,GAAG,CAACF,OAAO,CAAC;MACnB;MAEA,IAAIG,IAAI,GAAGlB,IAAI,CAACO,UAAU,CAACC,WAAW,CAAC,CAAC;MACxC,IAAIF,KAAK,GAAGF,QAAQ,CAAC,OAAO,CAAC;MAC7B,IAAIe,IAAI,GAAGb,KAAK,CAACO,MAAM;MAEvB,KAAK,IAAIO,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,IAAI,EAAEC,CAAC,EAAE,EAAE;QAC7B,IAAIC,OAAO,GAAG,IAAItB,EAAE,CAACuB,IAAI,CAAChB,KAAK,CAACc,CAAC,CAAC,CAAC;QACnCF,IAAI,CAACK,OAAO,CAACF,OAAO,CAAC;MACvB;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AAEJ,CAAC,CAAC;AAAAG,OAAA,CAAAtB,YAAA,GAAAA,YAAA;AAEF,IAAIuB,YAAY,GAAAD,OAAA,CAAAC,YAAA,GAAG,IAAIvB,YAAY,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ucumLhcUtils.js","names":["_ucumJsonDefs","require","intUtils_","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Ucum","UnitTables","UnitString","UcumLhcUtils","constructor","getInstance","unitsCount","ucumJsonDefs","loadJsonDefs","uStrParser_","massDimIndex_","getMassDimensionIndex","useHTMLInMessages","use","undefined","useBraceMsgForEachString","validateUnitString","uStr","suggest","valConv","resp","getSpecifiedUnit","theUnit","retObj","csCode_","name_","guidance_","status","detectConversionType","fromUnit","toUnit","conversionType","moleExp_","equivalentExp_","dim_","getElementAt","convertUnitTo","fromUnitCode","fromVal","toUnitCode","options","molecularWeight","charge","returnObj","trim","push","_checkFromVal","parseResp","concat","convertType","msgCountBeforeConvert","length","convertFrom","err","message","isMolMassCommensurable","needMoleWeightMsg_","convertMolMass","isEqMassCommensurable","needEqWeightMsg_","needEqChargeMsg_","convertEqMass","isEqMolCommensurable","convertEqMol","isEqMolMassCommensurable","convertEqMolMass","convertToBaseUnits","inputUnitLookup","unit","msg","retMsg","isArbitrary_","unitToExp","dimVec","dimVec_","baseUnitString","dimVecIndexToBaseUnit","dimVecIndexToBaseUnit_","len","exp","retUnitLookup","retUnit","magnitude","toString","fromUnitIsSpecial","isSpecial_","responseObj","isNaN","isNumericString","checkSynonyms","theSyn","getSynonyms","uName","utab","getUnitByCode","parseString","console","log","unshift","origString","commensurablesList","fromName","categoryList","commUnits","fromDim","getProperty","getUnitsByDimension","filter","item","indexOf","category_","exports"],"sources":["../source/ucumLhcUtils.js"],"sourcesContent":["/**\n * This class provides a single point of access to the LHC UCUM utilities\n *\n * @author Lee Mericle\n *\n */\nvar Ucum = require('./config.js').Ucum;\nimport {ucumJsonDefs} from './ucumJsonDefs.js';\nvar UnitTables = require('./unitTables.js').UnitTables;\nvar UnitString = require('./unitString.js').UnitString;\n\nimport * as intUtils_ from \"./ucumInternalUtils.js\";\n\n/**\n * UCUM external utilities class\n */\nexport class UcumLhcUtils {\n\n /**\n * Constructor. This loads the json prefix and unit definitions if\n * they haven't been loaded already and creates itself as a singleton object.\n *\n */\n constructor() {\n\n if (UnitTables.getInstance().unitsCount() === 0) {\n\n // Load the prefix and unit objects\n ucumJsonDefs.loadJsonDefs();\n }\n\n // Get the UnitString parser that will be used with this instance\n // of the LHC Utilities\n this.uStrParser_ = UnitString.getInstance();\n\n // Get a copy of the mass dimension index.\n this.massDimIndex_ = UnitTables.getInstance().getMassDimensionIndex();\n } // end constructor\n\n\n /**\n * This method calls the useHTMLInMessages method on the UnitString\n * object. It should be called by web applications that use\n * these utilities.\n *\n * @param use flag indicating whether or not to use the braces message;\n * defaults to true\n */\n useHTMLInMessages(use) {\n if (use === undefined)\n use = true ;\n this.uStrParser_.useHTMLInMessages(use);\n }\n\n\n /**\n * This method calls the useBraceMsgForEachString method on the UnitString\n * object. It should be called by web applications where unit\n * strings are validated individually (as opposed to validating a whole\n * file of unit strings).\n *\n * @param use flag indicating whether or not to use the braces message;\n * defaults to true\n */\n useBraceMsgForEachString(use) {\n if (use === undefined)\n use = true ;\n this.uStrParser_.useBraceMsgForEachString(use);\n }\n\n\n /**\n * This method validates a unit string. It first checks to see if the\n * string passed in is a unit code that is found in the unit codes table.\n * If it is not found it parses the string to see if it resolves to a\n * valid unit string.\n *\n * If a valid unit cannot be found, the string is tested for some common\n * errors, such as missing brackets or a missing multiplication operator.\n * If found, the error is reported in the messages array that is returned.\n *\n * If a valid unit cannot be found and an error cannot be discerned, this\n * may return, if requested, a list of suggested units in the messages\n * array that is returned. Suggestions are based on matching the expression\n * with unit names and synonyms.\n *\n * @param uStr the string to be validated\n * @param suggest a boolean to indicate whether or not suggestions are\n * requested for a string that cannot be resolved to a valid unit;\n * true indicates suggestions are wanted; false indicates they are not,\n * and is the default if the parameter is not specified;\n * @param valConv a string indicating if this validation request was initiated\n * by a validation task ('validate') or a conversion task ('convert'),\n * used only for the demo code, and the default is 'Validator' if the\n * parameter is not specified;\n * @returns an object with five properties:\n * 'status' will be 'valid' (the uStr is a valid UCUM code), 'invalid'\n * (the uStr is not a valid UCUM code, and substitutions or\n * suggestions may or may not be returned, depending on what was\n * requested and found); or 'error' (an input or programming error\n * occurred);\n * 'ucumCode' the valid ucum code, which may differ from what was passed\n * in (e.g., if 'Gauss' is passed in, this will contain 'G') OR null if\n * the string was flagged as invalid or an error occurred;\n * 'msg' is an array of one or more messages, if the string is invalid or\n * an error occurred, indicating the problem, or an explanation of a\n * substitution such as the substitution of 'G' for 'Gauss', or\n * an empty array if no messages were generated;\n * 'unit' which is null if no unit is found, or a hash for a unit found:\n * 'code' is the unit's ucum code (G in the above example;\n * 'name' is the unit's name (Gauss in the above example); and\n * 'guidance' is the unit's guidance/description data; and\n * 'suggestions' if suggestions were requested and found, this is an array\n * of one or more hash objects. Each hash contains three elements:\n * 'msg' which is a message indicating what part of the uStr input\n * parameter the suggestions are for;\n * 'invalidUnit' which is the unit expression the suggestions are\n * for; and\n * 'units' which is an array of data for each suggested unit found.\n * Each array will contain the unit code, the unit name and the\n * unit guidance (if any).\n * If no suggestions were requested and found, this property is not\n * returned.\n */\n validateUnitString(uStr, suggest, valConv) {\n\n if (suggest === undefined)\n suggest = false ;\n\n if (valConv === undefined)\n valConv = 'validate' ;\n\n let resp = this.getSpecifiedUnit(uStr, valConv, suggest);\n let theUnit = resp['unit'];\n let retObj = !theUnit ? {'ucumCode': null} :\n {'ucumCode': resp['origString'],\n 'unit': {'code': theUnit.csCode_,\n 'name': theUnit.name_,\n 'guidance': theUnit.guidance_ }};\n retObj.status = resp.status;\n if (resp['suggestions']) {\n retObj['suggestions'] = resp['suggestions'];\n }\n retObj['msg'] = resp['retMsg'];\n return retObj;\n\n } // end validateUnitString\n\n\n// Note that below when the value of ConversionType is mol|mass, it refers to\n// either a conversion from mol to mass or from mass to mol.\n/**\n * @typedef {\n * 'normal',\n * 'mol|mass',\n * 'eq|mass',\n * 'eq|mol',\n * 'eq|mol|mass'\n * } ConversionType\n */\n\n /**\n * Detects the type of conversion between two units.\n *\n * @param {Object} fromUnit - The unit to convert from.\n * @param {Object} toUnit - The unit to convert to.\n * @returns {ConversionType} conversionType - The type of conversion as a string.\n */\n detectConversionType(fromUnit, toUnit) {\n /** @type {ConversionType} */\n let conversionType;\n if (fromUnit.moleExp_ == toUnit.moleExp_ &&\n fromUnit.equivalentExp_ == toUnit.equivalentExp_) {\n // Since the powers of the equivalents and mole in the units are the same in both\n // units, no conversion is going to happen between mass, mol, and eq.\n // There is the possibility that someone is trying to convert 'g' to 'g2',\n // but we will handle that as the \"normal\" case (and later find it invalid).\n conversionType = 'normal';\n }\n else if (fromUnit.equivalentExp_ == toUnit.equivalentExp_) {\n // In this case, the units have the same power of equivalents, so (because\n // it is not the first case) the units have different powers of mol and mass,\n // so this must be a conversion between mol and mass.\n conversionType = 'mol|mass';\n }\n else if (fromUnit.moleExp_ == toUnit.moleExp_) {\n // In this case, the units have the same power of mol, so (because\n // it is not the first case) the units have different powers of equivalents and mass,\n // so this must be a conversion between equivalents and mass.\n conversionType = 'eq|mass';\n }\n else if (fromUnit.dim_.getElementAt(this.massDimIndex_) ==\n toUnit.dim_.getElementAt(this.massDimIndex_)) {\n // In this case, the units have the same power of mass, so (because\n // it is not the first case) the units have different powers of equivalents and mol,\n // so this must be a conversion between equivalents and moles.\n conversionType = 'eq|mol';\n }\n else {\n // In this case, the units have different powers of mass, mol, and\n // equivalents, so there is a conversion between mass, mol, and\n // equivalents.\n conversionType = 'eq|mol|mass';\n }\n\n return conversionType;\n } // end detectConversionType\n\n\n /**\n * @typedef {{\n * status: 'succeeded' | 'failed' | 'error',\n * toVal: number | null,\n * msg: string[],\n * suggestions: {\n * from: {\n * msg: string,\n * invalidUnit: string,\n * units: string[]\n * },\n * to: {\n * msg: string,\n * invalidUnit: string,\n * units: string[]\n * }\n * },\n * fromUnit: string,\n * toUnit: string\n * }} ConvertUnitResult\n */\n\n\n /**\n * This method converts one unit to another\n *\n * @param {string} fromUnitCode - the unit code/expression/string of the unit to be converted\n * @param {number | string} fromVal - the number of \"from\" units to be converted to \"to\" units\n * @param {string} toUnitCode - the unit code/expression/string of the unit that the from field is to be converted to\n * @param {{\n * suggest?: boolean,\n * molecularWeight?: number\n * charge?: number\n * }} options\n * - suggest: a boolean to indicate whether or not suggestions are requested for a string that cannot be resolved to a valid unit;\n * true indicates suggestions are wanted; false indicates they are not, and is the default if the parameter is not specified;\n * - molecularWeight: the molecular weight of the substance in question when a conversion is being requested from mass to moles and vice versa.\n * This is required when one of the units represents a value in moles. It is ignored if neither unit includes a measurement in moles.\n * - charge: the absolute value of the charge of the substance in question when a conversion is being requested from mass/moles to\n * equivalents and vice versa. It is required when one of the units represents a value in equivalents and the other in mass or moles.\n * It is ignored if neither unit includes an equivalent unit.\n * @returns {ConvertUnitResult}\n * - a hash with six elements:\n * - 'status' that will be: 'succeeded' if the conversion was successfully\n * calculated; 'failed' if the conversion could not be made, e.g., if\n * the units are not commensurable; or 'error' if an error occurred;\n * - 'toVal' the numeric value indicating the conversion amount, or null\n * if the conversion failed (e.g., if the units are not commensurable);\n * - 'msg' is an array message, if the string is invalid or an error occurred,\n * indicating the problem, or an explanation of a substitution such as\n * the substitution of 'G' for 'Gauss', or an empty array if no\n * messages were generated;\n * - 'suggestions' if suggestions were requested and found, this is a hash\n * that contains at most two elements:\n * - 'from' which, if the fromUnitCode input parameter or one or more of\n * its components could not be found, is an array one or more hash\n * objects. Each hash contains three elements:\n * - 'msg' which is a message indicating what unit expression the\n * suggestions are for;\n * - 'invalidUnit' which is the unit expression the suggestions\n * are for; and\n * - 'units' which is an array of data for each suggested unit found.\n * Each array will contain the unit code, the unit name and the\n * unit guidance (if any).\n * If no suggestions were found for the fromUnitCode this element\n * will not be included.\n * - 'to' which, if the \"to\" unit expression or one or more of its\n * components could not be found, is an array one or more hash objects. Each hash\n * contains three elements:\n * - 'msg' which is a message indicating what toUnitCode input\n * parameter the suggestions are for;\n * - 'invalidUnit' which is the unit expression the suggestions\n * are for; and\n * - 'units' which is an array of data for each suggested unit found.\n * Each array will contain the unit code, the unit name and the\n * unit guidance (if any).\n * If no suggestions were found for the toUnitCode this element\n * will not be included.\n * No 'suggestions' element will be included in the returned hash\n * object if none were found, whether or not they were requested.\n * - 'fromUnit' the unit object for the fromUnitCode passed in; returned\n * in case it's needed for additional data from the object; and\n * - 'toUnit' the unit object for the toUnitCode passed in; returned\n * in case it's needed for additional data from the object.\n */\n convertUnitTo(fromUnitCode, fromVal, toUnitCode, options = {}) {\n let {suggest = false, molecularWeight = null, charge = null} = options;\n\n /** @type {ConvertUnitResult} */\n let returnObj = {\n 'status': 'failed',\n 'toVal': null,\n 'msg': []\n };\n\n if (fromUnitCode) {\n fromUnitCode = fromUnitCode.trim();\n }\n if (!fromUnitCode || fromUnitCode == '') {\n returnObj['status'] = 'error';\n returnObj['msg'].push('No \"from\" unit expression specified.');\n }\n this._checkFromVal(fromVal, returnObj);\n if (toUnitCode) {\n toUnitCode = toUnitCode.trim();\n }\n if (!toUnitCode || toUnitCode == '') {\n returnObj['status'] = 'error';\n returnObj['msg'].push('No \"to\" unit expression specified.');\n }\n if (returnObj['status'] !== 'error') {\n let fromUnit = null;\n\n let parseResp = this.getSpecifiedUnit(fromUnitCode, 'convert', suggest);\n fromUnit = parseResp['unit'];\n if (parseResp['retMsg'])\n returnObj['msg'] = returnObj['msg'].concat(parseResp['retMsg']);\n if (parseResp['suggestions']) {\n returnObj['suggestions'] = {};\n returnObj['suggestions']['from'] = parseResp['suggestions'];\n }\n if (!fromUnit) {\n returnObj['msg'].push(`Unable to find a unit for ${fromUnitCode}, ` +\n `so no conversion could be performed.`);\n }\n\n let toUnit = null;\n parseResp = this.getSpecifiedUnit(toUnitCode, 'convert', suggest);\n toUnit = parseResp['unit'];\n if (parseResp['retMsg'])\n returnObj['msg'] = returnObj['msg'].concat(parseResp['retMsg']);\n if (parseResp['suggestions']) {\n if (!returnObj['suggestions'])\n returnObj['suggestions'] = {};\n returnObj['suggestions']['to'] = parseResp['suggestions'];\n }\n if (!toUnit) {\n returnObj['msg'].push(`Unable to find a unit for ${toUnitCode}, ` +\n `so no conversion could be performed.`);\n }\n\n if (fromUnit && toUnit) {\n const convertType = this.detectConversionType(fromUnit, toUnit);\n const msgCountBeforeConvert = returnObj['msg'].length;\n switch (convertType) {\n case 'normal':\n try {\n returnObj['toVal'] = toUnit.convertFrom(fromVal, fromUnit);\n } catch (err) {\n returnObj['msg'].push(err.message);\n }\n break;\n case 'mol|mass':\n if (!fromUnit.isMolMassCommensurable(toUnit)) {\n returnObj['msg'].push(`Sorry. ${fromUnitCode} cannot be ` +\n `converted to ${toUnitCode}.`);\n break;\n }\n if (!molecularWeight) {\n returnObj['msg'].push(Ucum.needMoleWeightMsg_);\n break;\n }\n returnObj['toVal'] = fromUnit.convertMolMass(fromVal, toUnit, molecularWeight);\n break;\n case 'eq|mass':\n if (!fromUnit.isEqMassCommensurable(toUnit)) {\n returnObj['msg'].push(`Sorry. ${fromUnitCode} cannot be ` +\n `converted to ${toUnitCode}.`);\n break;\n }\n if (!molecularWeight) {\n returnObj['msg'].push(Ucum.needEqWeightMsg_);\n }\n if (!charge) {\n returnObj['msg'].push(Ucum.needEqChargeMsg_);\n }\n if (!returnObj['msg'].length) {\n returnObj['toVal'] = fromUnit.convertEqMass(fromVal, toUnit, molecularWeight, charge);\n }\n break;\n case 'eq|mol':\n if (!fromUnit.isEqMolCommensurable(toUnit)) {\n returnObj['msg'].push(`Sorry. ${fromUnitCode} cannot be ` +\n `converted to ${toUnitCode}.`);\n break;\n }\n if (!charge) {\n returnObj['msg'].push(Ucum.needEqChargeMsg_);\n break;\n }\n returnObj['toVal'] = fromUnit.convertEqMol(fromVal, toUnit, charge);\n break;\n case 'eq|mol|mass':\n if (!fromUnit.isEqMolMassCommensurable(toUnit)) {\n returnObj['msg'].push(`Sorry. ${fromUnitCode} cannot be ` +\n `converted to ${toUnitCode}.`);\n break;\n }\n if (!molecularWeight) {\n returnObj['msg'].push(Ucum.needEqWeightMsg_);\n }\n if (!charge) {\n returnObj['msg'].push(Ucum.needEqChargeMsg_);\n }\n if (!returnObj['msg'].length) {\n returnObj['toVal'] = fromUnit.convertEqMolMass(fromVal, toUnit, molecularWeight, charge);\n }\n break;\n default:\n returnObj['msg'].push(\"Unknown conversion type. No conversion was attempted.\");\n }\n if (returnObj['msg'].length > msgCountBeforeConvert) {\n // If one or more failure messages are pushed into returnObj['msg']\n // in the switch statement, mark the status as 'failed'.\n returnObj['status'] = 'failed';\n } else {\n // Set the return object to show success.\n returnObj['status'] = 'succeeded';\n returnObj['fromUnit'] = fromUnit;\n returnObj['toUnit'] = toUnit;\n }\n } // end if we have the from and to units\n }\n\n return returnObj;\n\n } // end convertUnitTo\n\n\n /**\n * Converts the given unit string into its base units, their exponents, and\n * a magnitude, and returns that data.\n * @param fromUnit the unit string to be converted to base units information\n * @param fromVal the number of \"from\" units to be converted\n * @returns an object with the properties:\n * 'status' indicates whether the result succeeded. The value will be one of:\n * 'succeeded': the conversion was successfully calculated (which can be\n * true even if it was already in base units);\n * 'invalid': fromUnit is not a valid UCUM code;\n * 'failed': the conversion could not be made (e.g., if it is an \"arbitrary\" unit);\n * 'error': if an error occurred (an input or programming error)\n * 'msg': an array of messages (possibly empty) if the string is invalid or\n * an error occurred, indicating the problem, or a suggestion of a\n * substitution such as the substitution of 'G' for 'Gauss', or\n * an empty array if no messages were generated. There can also be a\n * message that is just informational or warning.\n * 'magnitude': the new value when fromVal units of fromUnits is expressed in the base units.\n * 'fromUnitIsSpecial': whether the input unit fromUnit is a \"special unit\"\n * as defined in UCUM. This means there is some function applied to convert\n * between fromUnit and the base units, so the returned magnitude is likely not\n * useful as a scale factor for other conversions (i.e., it only has validity\n * and usefulness for the input values that produced it).\n * 'unitToExp': a map of base units in fromUnit to their exponent\n */\n convertToBaseUnits(fromUnit, fromVal) {\n let retObj = {};\n this._checkFromVal(fromVal, retObj);\n if (!retObj.status) { // could be set to 'error' by _checkFromVal\n let inputUnitLookup = this.getSpecifiedUnit(fromUnit, 'validate');\n retObj = {status: inputUnitLookup.status == 'valid' ? 'succeeded' : inputUnitLookup.status};\n let unit = inputUnitLookup.unit;\n retObj.msg = inputUnitLookup.retMsg || [];\n if (!unit) {\n if (inputUnitLookup.retMsg?.length == 0)\n retObj.msg.push('Could not find unit information for '+fromUnit);\n }\n else if (unit.isArbitrary_) {\n retObj.msg.push('Arbitrary units cannot be converted to base units or other units.');\n retObj.status = 'failed';\n }\n else if (retObj.status == 'succeeded') {\n let unitToExp = {};\n let dimVec = unit.dim_?.dimVec_\n let baseUnitString = '1';\n if (dimVec) {\n let dimVecIndexToBaseUnit = UnitTables.getInstance().dimVecIndexToBaseUnit_;\n for (let i=0, len=dimVec.length; i<len; ++i) {\n let exp = dimVec[i];\n if (exp) {\n unitToExp[dimVecIndexToBaseUnit[i]] = exp;\n baseUnitString += '.' + dimVecIndexToBaseUnit[i] + exp;\n }\n }\n }\n\n // The unit might have a conversion function, which has to be applied; we\n // cannot just assume unit_.magnitude_ is the magnitude in base units.\n let retUnitLookup = this.getSpecifiedUnit(baseUnitString, 'validate');\n // There should not be any error in retUnitLookup, unless there is a bug.\n let retUnit = retUnitLookup.unit;\n if (retUnitLookup.status !== 'valid') {\n retObj.msg.push('Unable construct base unit string; tried '+baseUnitString);\n retObj.status = 'error';\n }\n else {\n try {\n retObj.magnitude = retUnit.convertFrom(fromVal, unit);\n }\n catch (e) {\n retObj.msg.push(e.toString());\n retObj.status = 'error';\n }\n if (retObj.status == 'succeeded') {\n retObj.unitToExp = unitToExp;\n retObj.fromUnitIsSpecial = unit.isSpecial_;\n }\n }\n }\n }\n return retObj;\n }\n\n\n /**\n * Checks the given value as to whether it is suitable as a \"from\" value in a\n * unit conversion. If it is not, the responseObj will have its status set\n * to 'error' and a message added.\n * @param fromVal The value to check\n * @param responseObj the object that will be updated if the value is not\n * usable.\n */\n _checkFromVal(fromVal, responseObj) {\n if (fromVal === null || isNaN(fromVal) || (typeof fromVal !== 'number' &&\n !intUtils_.isNumericString(fromVal))) {\n responseObj.status = 'error';\n if (!responseObj.msg)\n responseObj.msg = [];\n responseObj.msg.push('No \"from\" value, or an invalid \"from\" value, ' +\n 'was specified.');\n }\n }\n\n\n /**\n * This method accepts a term and looks for units that include it as\n * a synonym - or that include the term in its name.\n *\n * @param theSyn the term to search for\n * @returns a hash with up to three elements:\n * 'status' contains the status of the request, which can be 'error',\n * 'failed' or succeeded';\n * 'msg' which contains a message for an error or if no units were found; and\n * 'units' which is an array that contains one hash for each unit found:\n * 'code' is the unit's csCode_\n * 'name' is the unit's name_\n * 'guidance' is the unit's guidance_\n *\n */\n checkSynonyms(theSyn) {\n let retObj = {} ;\n if (theSyn === undefined || theSyn === null) {\n retObj['status'] = 'error';\n retObj['msg'] = 'No term specified for synonym search.'\n }\n else {\n retObj = intUtils_.getSynonyms(theSyn);\n } // end if a search synonym was supplied\n\n return retObj ;\n\n } // end checkSynonyms\n\n\n /**\n * This method parses a unit string to get (or try to get) the unit\n * represented by the string. It returns an error message if no string was specified\n * or if any errors were encountered trying to get the unit.\n *\n * @param uName the expression/string representing the unit\n * @param valConv indicates what type of request this is for - a request to\n * validate (pass in 'validate') or a request to convert (pass in 'convert')\n * @param suggest a boolean to indicate whether or not suggestions are\n * requested for a string that cannot be resolved to a valid unit;\n * true indicates suggestions are wanted; false indicates they are not,\n * and is the default if the parameter is not specified;\n * @returns a hash containing:\n * 'status' will be 'valid' (uName is a valid UCUM code), 'invalid'\n * (the uStr is not a valid UCUM code, and substitutions or\n * suggestions may or may not be returned, depending on what was\n * requested and found); or 'error' (an input or programming error\n * occurred);\n * 'unit' the unit object (or null if there were problems creating the\n * unit);\n * 'origString' the possibly updated unit string passed in;\n * 'retMsg' an array of user messages (informational, error or warning) if\n * any were generated (IF any were generated, otherwise will be an\n * empty array); and\n * 'suggestions' is an array of 1 or more hash objects. Each hash\n * contains three elements:\n * 'msg' which is a message indicating what unit expression the\n * suggestions are for;\n * 'invalidUnit' which is the unit expression the suggestions are\n * for; and\n * 'units' which is an array of data for each suggested unit found.\n * Each array will contain the unit code, the unit name and the\n * unit guidance (if any).\n * The return hash will not contain a suggestions array if a valid unit\n * was found or if suggestions were not requested and found.\n */\n getSpecifiedUnit(uName, valConv, suggest) {\n\n if (suggest === undefined)\n suggest = false ;\n\n let retObj = {};\n retObj['retMsg'] = [];\n\n if (!uName) {\n retObj['retMsg'].push('No unit string specified.');\n }\n else {\n let utab = UnitTables.getInstance();\n uName = uName.trim();\n\n // go ahead and just try using the name as the code. This may or may not\n // work, but if it does, it cuts out a lot of parsing.\n let theUnit = utab.getUnitByCode(uName);\n\n // If we found it, set the returned unit string to what was passed in;\n // otherwise try parsing as a unit string\n if (theUnit) {\n retObj['unit'] = theUnit ;\n retObj['origString'] = uName;\n }\n else {\n try {\n let resp = this.uStrParser_.parseString(uName, valConv, suggest);\n retObj['unit'] = resp[0];\n retObj['origString'] = resp[1];\n if (resp[2])\n retObj['retMsg'] = resp[2];\n retObj['suggestions'] = resp[3];\n }\n catch (err) {\n console.log(`Unit requested for unit string ${uName}.` +\n 'request unsuccessful; error thrown = ' + err.message);\n retObj['retMsg'].unshift(`${uName} is not a valid unit. ` +\n `${err.message}`);\n }\n } // end if the unit was not found as a unit name\n } // end if a unit expression was specified\n\n // Set the status field\n if (!retObj.unit) {\n // No unit was found; check whether origString has a value\n retObj.status = !retObj.origString ? 'error' : 'invalid';\n }\n else {\n // Check whether substitutions were made to the unit string in order to\n // find the unit\n retObj.status = retObj.origString === uName ? 'valid': 'invalid';\n }\n\n return retObj;\n\n } // end getSpecifiedUnit\n\n\n /**\n * This method retrieves a list of units commensurable, i.e., that can be\n * converted from and to, a specified unit. Returns an error if the \"from\"\n * unit cannot be found. If necessary, you can filter the list of units by\n * specifying a list of unit categories that should be in the resulting list.\n *\n * @param {string} fromName - the name/unit string of the \"from\" unit\n * @param {string[] | null} [categoryList] - the list of unit categories;\n * this parameter is optional, defaults to null if not specified;\n * possible list values: 'Clinical', 'Nonclinical', 'Obsolete', 'Constant'\n * @returns an array containing two elements;\n * first element is the list of commensurable units if any were found;\n * second element is an error message if the \"from\" unit is not found\n */\n commensurablesList(fromName, categoryList = null) {\n\n let retMsg = [];\n let commUnits = null ;\n let parseResp = this.getSpecifiedUnit(fromName, 'validate', false);\n let fromUnit = parseResp['unit'];\n if (parseResp['retMsg'].length > 0)\n retMsg = parseResp['retMsg'] ;\n if (!fromUnit) {\n retMsg.push(`Could not find unit ${fromName}.`);\n }\n else {\n let dimVec = null ;\n let fromDim = fromUnit.getProperty('dim_');\n if (!fromDim) {\n retMsg.push('No commensurable units were found for ' + fromName) ;\n }\n else {\n try {\n dimVec = fromDim.getProperty('dimVec_');\n }\n catch (err) {\n retMsg.push(err.message);\n if (err.message ===\n \"Dimension does not have requested property(dimVec_)\")\n dimVec = null;\n }\n if (dimVec) {\n let utab = UnitTables.getInstance();\n commUnits = utab.getUnitsByDimension(dimVec);\n if (categoryList) {\n commUnits = commUnits.filter((item) => {\n return categoryList.indexOf(item.category_) !== -1;\n });\n }\n }\n } // end if the from unit has a dimension vector\n } // end if we found a \"from\" unit\n return [commUnits , retMsg];\n } // end commensurablesList\n\n} // end UcumLhcUtils class\n\n\n/**\n * This function exists ONLY until the original UcumLhcUtils constructor\n * is called for the first time. It's defined here in case getInstance\n * is called before the constructor. This calls the constructor.\n *\n * The constructor redefines the getInstance function to return the\n * singleton UcumLhcUtils object. This is based on the UnitTables singleton\n * implementation; see more detail in the UnitTables constructor description.\n *\n * NO LONGER TRUE - not implemented as a singleton. This method retained to\n * avoid problems with calls to it that exist throughout the code.\n *\n * @return the (formerly singleton) UcumLhcUtils object.\n */\nUcumLhcUtils.getInstance = function(){\n return new UcumLhcUtils();\n} ;\n"],"mappings":";;;;;;AAOA,IAAAA,aAAA,GAAAC,OAAA;AAIA,IAAAC,SAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAoD,SAAAE,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MA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ACD;AACA;AACA;AACA;AACA;AACA;EACEK,oBAAoBA,CAACC,QAAQ,EAAEC,MAAM,EAAE;IACrC;IACA,IAAIC,cAAc;IAClB,IAAIF,QAAQ,CAACG,QAAQ,IAAIF,MAAM,CAACE,QAAQ,IACpCH,QAAQ,CAACI,cAAc,IAAIH,MAAM,CAACG,cAAc,EAAE;MACpD;MACA;MACA;MACA;MACAF,cAAc,GAAG,QAAQ;IAC3B,CAAC,MACI,IAAIF,QAAQ,CAACI,cAAc,IAAIH,MAAM,CAACG,cAAc,EAAE;MACzD;MACA;MACA;MACAF,cAAc,GAAG,UAAU;IAC7B,CAAC,MACI,IAAIF,QAAQ,CAACG,QAAQ,IAAIF,MAAM,CAACE,QAAQ,EAAE;MAC7C;MACA;MACA;MACAD,cAAc,GAAG,SAAS;IAC5B,CAAC,MACI,IAAIF,QAAQ,CAACK,IAAI,CAACC,YAAY,CAAC,IAAI,CAACzB,aAAa,CAAC,IACjDoB,MAAM,CAACI,IAAI,CAACC,YAAY,CAAC,IAAI,CAACzB,aAAa,CAAC,EAAE;MAClD;MACA;MACA;MACAqB,cAAc,GAAG,QAAQ;IAC3B,CAAC,MACI;MACH;MACA;MACA;MACAA,cAAc,GAAG,aAAa;IAChC;IAEA,OAAOA,cAAc;EACvB,CAAC,CAAC;;EAGF;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEK,aAAaA,CAACC,YAAY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QACH,IAAI;UACF5B,MAAM,GAAG+B,OAAO,CAACC,WAAW,CAAC,SAAS,CAAC;QACzC,CAAC,CACD,OAAOpD,GAAG,EAAE;UACViB,MAAM,CAACzB,IAAI,CAACQ,GAAG,CAACC,OAAO,CAAC;UACxB,IAAID,GAAG,CAACC,OAAO,KACb,qDAAqD,EACrDmB,MAAM,GAAG,IAAI;QACjB;QACA,IAAIA,MAAM,EAAE;UACV,IAAIoB,IAAI,GAAG5F,UAAU,CAACI,WAAW,CAAC,CAAC;UACnCkG,SAAS,GAAGV,IAAI,CAACa,mBAAmB,CAACjC,MAAM,CAAC;UAC5C,IAAI6B,YAAY,EAAE;YAChBC,SAAS,GAAGA,SAAS,CAACI,MAAM,CAAEC,IAAI,IAAK;cACrC,OAAON,YAAY,CAACO,OAAO,CAACD,IAAI,CAACE,SAAS,CAAC,KAAK,CAAC,CAAC;YACpD,CAAC,CAAC;UACJ;QACF;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,CAACP,SAAS,EAAGjC,MAAM,CAAC;EAC7B,CAAC,CAAC;AAEJ,CAAC,CAAC;;AAGF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAbAyC,OAAA,CAAA5G,YAAA,GAAAA,YAAA;AAcAA,YAAY,CAACE,WAAW,GAAG,YAAU;EACnC,OAAO,IAAIF,YAAY,CAAC,CAAC;AAC3B,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ucumLhcUtils.js","names":["_ucumJsonDefs","require","intUtils_","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Ucum","UnitTables","UnitString","UcumLhcUtils","constructor","getInstance","unitsCount","ucumJsonDefs","loadJsonDefs","uStrParser_","massDimIndex_","getMassDimensionIndex","useHTMLInMessages","use","undefined","useBraceMsgForEachString","validateUnitString","uStr","suggest","valConv","resp","getSpecifiedUnit","theUnit","retObj","csCode_","name_","guidance_","status","detectConversionType","fromUnit","toUnit","conversionType","moleExp_","equivalentExp_","dim_","getElementAt","convertUnitTo","fromUnitCode","fromVal","toUnitCode","options","molecularWeight","charge","returnObj","trim","push","_checkFromVal","parseResp","concat","convertType","msgCountBeforeConvert","length","convertFrom","err","message","isMolMassCommensurable","needMoleWeightMsg_","convertMolMass","isEqMassCommensurable","needEqWeightMsg_","needEqChargeMsg_","convertEqMass","isEqMolCommensurable","convertEqMol","isEqMolMassCommensurable","convertEqMolMass","convertToBaseUnits","inputUnitLookup","unit","msg","retMsg","isArbitrary_","unitToExp","dimVec","dimVec_","baseUnitString","dimVecIndexToBaseUnit","dimVecIndexToBaseUnit_","len","exp","retUnitLookup","retUnit","magnitude","toString","fromUnitIsSpecial","isSpecial_","responseObj","isNaN","isNumericString","checkSynonyms","theSyn","getSynonyms","uName","utab","getUnitByCode","parseString","console","log","unshift","origString","commensurablesList","fromName","categoryList","commUnits","fromDim","getProperty","getUnitsByDimension","filter","item","indexOf","category_","exports"],"sources":["../source/ucumLhcUtils.js"],"sourcesContent":["/**\n * This class provides a single point of access to the LHC UCUM utilities\n *\n * @author Lee Mericle\n *\n */\nvar Ucum = require('./config.js').Ucum;\nimport {ucumJsonDefs} from './ucumJsonDefs.js';\nvar UnitTables = require('./unitTables.js').UnitTables;\nvar UnitString = require('./unitString.js').UnitString;\n\nimport * as intUtils_ from \"./ucumInternalUtils.js\";\n\n/**\n * UCUM external utilities class\n */\nexport class UcumLhcUtils {\n\n /**\n * Constructor. This loads the json prefix and unit definitions if\n * they haven't been loaded already and creates itself as a singleton object.\n *\n */\n constructor() {\n\n if (UnitTables.getInstance().unitsCount() === 0) {\n\n // Load the prefix and unit objects\n ucumJsonDefs.loadJsonDefs();\n }\n\n // Get the UnitString parser that will be used with this instance\n // of the LHC Utilities\n this.uStrParser_ = UnitString.getInstance();\n\n // Get a copy of the mass dimension index.\n this.massDimIndex_ = UnitTables.getInstance().getMassDimensionIndex();\n } // end constructor\n\n\n /**\n * This method calls the useHTMLInMessages method on the UnitString\n * object. It should be called by web applications that use\n * these utilities.\n *\n * @param use flag indicating whether or not to use the braces message;\n * defaults to true\n */\n useHTMLInMessages(use) {\n if (use === undefined)\n use = true ;\n this.uStrParser_.useHTMLInMessages(use);\n }\n\n\n /**\n * This method calls the useBraceMsgForEachString method on the UnitString\n * object. It should be called by web applications where unit\n * strings are validated individually (as opposed to validating a whole\n * file of unit strings).\n *\n * @param use flag indicating whether or not to use the braces message;\n * defaults to true\n */\n useBraceMsgForEachString(use) {\n if (use === undefined)\n use = true ;\n this.uStrParser_.useBraceMsgForEachString(use);\n }\n\n\n /**\n * This method validates a unit string. It first checks to see if the\n * string passed in is a unit code that is found in the unit codes table.\n * If it is not found it parses the string to see if it resolves to a\n * valid unit string.\n *\n * If a valid unit cannot be found, the string is tested for some common\n * errors, such as missing brackets or a missing multiplication operator.\n * If found, the error is reported in the messages array that is returned.\n *\n * If a valid unit cannot be found and an error cannot be discerned, this\n * may return, if requested, a list of suggested units in the messages\n * array that is returned. Suggestions are based on matching the expression\n * with unit names and synonyms.\n *\n * @param uStr the string to be validated\n * @param suggest a boolean to indicate whether or not suggestions are\n * requested for a string that cannot be resolved to a valid unit;\n * true indicates suggestions are wanted; false indicates they are not,\n * and is the default if the parameter is not specified;\n * @param valConv a string indicating if this validation request was initiated\n * by a validation task ('validate') or a conversion task ('convert'),\n * used only for the demo code, and the default is 'Validator' if the\n * parameter is not specified;\n * @returns an object with five properties:\n * 'status' will be 'valid' (the uStr is a valid UCUM code), 'invalid'\n * (the uStr is not a valid UCUM code, and substitutions or\n * suggestions may or may not be returned, depending on what was\n * requested and found); or 'error' (an input or programming error\n * occurred);\n * 'ucumCode' the valid ucum code, which may differ from what was passed\n * in (e.g., if 'Gauss' is passed in, this will contain 'G') OR null if\n * the string was flagged as invalid or an error occurred;\n * 'msg' is an array of one or more messages, if the string is invalid or\n * an error occurred, indicating the problem, or an explanation of a\n * substitution such as the substitution of 'G' for 'Gauss', or\n * an empty array if no messages were generated;\n * 'unit' which is null if no unit is found, or a hash for a unit found:\n * 'code' is the unit's ucum code (G in the above example;\n * 'name' is the unit's name (Gauss in the above example); and\n * 'guidance' is the unit's guidance/description data; and\n * 'suggestions' if suggestions were requested and found, this is an array\n * of one or more hash objects. Each hash contains three elements:\n * 'msg' which is a message indicating what part of the uStr input\n * parameter the suggestions are for;\n * 'invalidUnit' which is the unit expression the suggestions are\n * for; and\n * 'units' which is an array of data for each suggested unit found.\n * Each array will contain the unit code, the unit name and the\n * unit guidance (if any).\n * If no suggestions were requested and found, this property is not\n * returned.\n */\n validateUnitString(uStr, suggest, valConv) {\n\n if (suggest === undefined)\n suggest = false ;\n\n if (valConv === undefined)\n valConv = 'validate' ;\n\n let resp = this.getSpecifiedUnit(uStr, valConv, suggest);\n let theUnit = resp['unit'];\n let retObj = !theUnit ? {'ucumCode': null} :\n {'ucumCode': resp['origString'],\n 'unit': {'code': theUnit.csCode_,\n 'name': theUnit.name_,\n 'guidance': theUnit.guidance_ }};\n retObj.status = resp.status;\n if (resp['suggestions']) {\n retObj['suggestions'] = resp['suggestions'];\n }\n retObj['msg'] = resp['retMsg'];\n return retObj;\n\n } // end validateUnitString\n\n\n// Note that below when the value of ConversionType is mol|mass, it refers to\n// either a conversion from mol to mass or from mass to mol.\n/**\n * @typedef {\n * 'normal',\n * 'mol|mass',\n * 'eq|mass',\n * 'eq|mol',\n * 'eq|mol|mass'\n * } ConversionType\n */\n\n /**\n * Detects the type of conversion between two units.\n *\n * @param {Object} fromUnit - The unit to convert from.\n * @param {Object} toUnit - The unit to convert to.\n * @returns {ConversionType} conversionType - The type of conversion as a string.\n */\n detectConversionType(fromUnit, toUnit) {\n /** @type {ConversionType} */\n let conversionType;\n if (fromUnit.moleExp_ == toUnit.moleExp_ &&\n fromUnit.equivalentExp_ == toUnit.equivalentExp_) {\n // Since the powers of the equivalents and mole in the units are the same in both\n // units, no conversion is going to happen between mass, mol, and eq.\n // There is the possibility that someone is trying to convert 'g' to 'g2',\n // but we will handle that as the \"normal\" case (and later find it invalid).\n conversionType = 'normal';\n }\n else if (fromUnit.equivalentExp_ == toUnit.equivalentExp_) {\n // In this case, the units have the same power of equivalents, so (because\n // it is not the first case) the units have different powers of mol and mass,\n // so this must be a conversion between mol and mass.\n conversionType = 'mol|mass';\n }\n else if (fromUnit.moleExp_ == toUnit.moleExp_) {\n // In this case, the units have the same power of mol, so (because\n // it is not the first case) the units have different powers of equivalents and mass,\n // so this must be a conversion between equivalents and mass.\n conversionType = 'eq|mass';\n }\n else if (fromUnit.dim_.getElementAt(this.massDimIndex_) ==\n toUnit.dim_.getElementAt(this.massDimIndex_)) {\n // In this case, the units have the same power of mass, so (because\n // it is not the first case) the units have different powers of equivalents and mol,\n // so this must be a conversion between equivalents and moles.\n conversionType = 'eq|mol';\n }\n else {\n // In this case, the units have different powers of mass, mol, and\n // equivalents, so there is a conversion between mass, mol, and\n // equivalents.\n conversionType = 'eq|mol|mass';\n }\n\n return conversionType;\n } // end detectConversionType\n\n\n /**\n * @typedef {{\n * status: 'succeeded' | 'failed' | 'error',\n * toVal: number | null,\n * msg: string[],\n * suggestions: {\n * from: {\n * msg: string,\n * invalidUnit: string,\n * units: string[]\n * },\n * to: {\n * msg: string,\n * invalidUnit: string,\n * units: string[]\n * }\n * },\n * fromUnit: string,\n * toUnit: string\n * }} ConvertUnitResult\n */\n\n\n /**\n * This method converts one unit to another\n *\n * @param {string} fromUnitCode - the unit code/expression/string of the unit to be converted\n * @param {number | string} fromVal - the number of \"from\" units to be converted to \"to\" units\n * @param {string} toUnitCode - the unit code/expression/string of the unit that the from field is to be converted to\n * @param {{\n * suggest?: boolean,\n * molecularWeight?: number\n * charge?: number\n * }} options\n * - suggest: a boolean to indicate whether or not suggestions are requested for a string that cannot be resolved to a valid unit;\n * true indicates suggestions are wanted; false indicates they are not, and is the default if the parameter is not specified;\n * - molecularWeight: the molecular weight of the substance in question when a conversion is being requested from mass to moles and vice versa.\n * This is required when one of the units represents a value in moles. It is ignored if neither unit includes a measurement in moles.\n * - charge: the absolute value of the charge of the substance in question when a conversion is being requested from mass/moles to\n * equivalents and vice versa. It is required when one of the units represents a value in equivalents and the other in mass or moles.\n * It is ignored if neither unit includes an equivalent unit.\n * @returns {ConvertUnitResult}\n * - a hash with six elements:\n * - 'status' that will be: 'succeeded' if the conversion was successfully\n * calculated; 'failed' if the conversion could not be made, e.g., if\n * the units are not commensurable; or 'error' if an error occurred;\n * - 'toVal' the numeric value indicating the conversion amount, or null\n * if the conversion failed (e.g., if the units are not commensurable);\n * - 'msg' is an array message, if the string is invalid or an error occurred,\n * indicating the problem, or an explanation of a substitution such as\n * the substitution of 'G' for 'Gauss', or an empty array if no\n * messages were generated;\n * - 'suggestions' if suggestions were requested and found, this is a hash\n * that contains at most two elements:\n * - 'from' which, if the fromUnitCode input parameter or one or more of\n * its components could not be found, is an array one or more hash\n * objects. Each hash contains three elements:\n * - 'msg' which is a message indicating what unit expression the\n * suggestions are for;\n * - 'invalidUnit' which is the unit expression the suggestions\n * are for; and\n * - 'units' which is an array of data for each suggested unit found.\n * Each array will contain the unit code, the unit name and the\n * unit guidance (if any).\n * If no suggestions were found for the fromUnitCode this element\n * will not be included.\n * - 'to' which, if the \"to\" unit expression or one or more of its\n * components could not be found, is an array one or more hash objects. Each hash\n * contains three elements:\n * - 'msg' which is a message indicating what toUnitCode input\n * parameter the suggestions are for;\n * - 'invalidUnit' which is the unit expression the suggestions\n * are for; and\n * - 'units' which is an array of data for each suggested unit found.\n * Each array will contain the unit code, the unit name and the\n * unit guidance (if any).\n * If no suggestions were found for the toUnitCode this element\n * will not be included.\n * No 'suggestions' element will be included in the returned hash\n * object if none were found, whether or not they were requested.\n * - 'fromUnit' the unit object for the fromUnitCode passed in; returned\n * in case it's needed for additional data from the object; and\n * - 'toUnit' the unit object for the toUnitCode passed in; returned\n * in case it's needed for additional data from the object.\n */\n convertUnitTo(fromUnitCode, fromVal, toUnitCode, options = {}) {\n let {suggest = false, molecularWeight = null, charge = null} = options;\n\n /** @type {ConvertUnitResult} */\n let returnObj = {\n 'status': 'failed',\n 'toVal': null,\n 'msg': []\n };\n\n if (fromUnitCode) {\n fromUnitCode = fromUnitCode.trim();\n }\n if (!fromUnitCode || fromUnitCode == '') {\n returnObj['status'] = 'error';\n returnObj['msg'].push('No \"from\" unit expression specified.');\n }\n this._checkFromVal(fromVal, returnObj);\n if (toUnitCode) {\n toUnitCode = toUnitCode.trim();\n }\n if (!toUnitCode || toUnitCode == '') {\n returnObj['status'] = 'error';\n returnObj['msg'].push('No \"to\" unit expression specified.');\n }\n if (returnObj['status'] !== 'error') {\n let fromUnit = null;\n\n let parseResp = this.getSpecifiedUnit(fromUnitCode, 'convert', suggest);\n fromUnit = parseResp['unit'];\n if (parseResp['retMsg'])\n returnObj['msg'] = returnObj['msg'].concat(parseResp['retMsg']);\n if (parseResp['suggestions']) {\n returnObj['suggestions'] = {};\n returnObj['suggestions']['from'] = parseResp['suggestions'];\n }\n if (!fromUnit) {\n returnObj['msg'].push(`Unable to find a unit for ${fromUnitCode}, ` +\n `so no conversion could be performed.`);\n }\n\n let toUnit = null;\n parseResp = this.getSpecifiedUnit(toUnitCode, 'convert', suggest);\n toUnit = parseResp['unit'];\n if (parseResp['retMsg'])\n returnObj['msg'] = returnObj['msg'].concat(parseResp['retMsg']);\n if (parseResp['suggestions']) {\n if (!returnObj['suggestions'])\n returnObj['suggestions'] = {};\n returnObj['suggestions']['to'] = parseResp['suggestions'];\n }\n if (!toUnit) {\n returnObj['msg'].push(`Unable to find a unit for ${toUnitCode}, ` +\n `so no conversion could be performed.`);\n }\n\n if (fromUnit && toUnit) {\n const convertType = this.detectConversionType(fromUnit, toUnit);\n const msgCountBeforeConvert = returnObj['msg'].length;\n switch (convertType) {\n case 'normal':\n try {\n returnObj['toVal'] = toUnit.convertFrom(fromVal, fromUnit);\n } catch (err) {\n returnObj['msg'].push(err.message);\n }\n break;\n case 'mol|mass':\n if (!fromUnit.isMolMassCommensurable(toUnit)) {\n returnObj['msg'].push(`Sorry. ${fromUnitCode} cannot be ` +\n `converted to ${toUnitCode}.`);\n break;\n }\n if (!molecularWeight) {\n returnObj['msg'].push(Ucum.needMoleWeightMsg_);\n break;\n }\n returnObj['toVal'] = fromUnit.convertMolMass(fromVal, toUnit, molecularWeight);\n break;\n case 'eq|mass':\n if (!fromUnit.isEqMassCommensurable(toUnit)) {\n returnObj['msg'].push(`Sorry. ${fromUnitCode} cannot be ` +\n `converted to ${toUnitCode}.`);\n break;\n }\n if (!molecularWeight) {\n returnObj['msg'].push(Ucum.needEqWeightMsg_);\n }\n if (!charge) {\n returnObj['msg'].push(Ucum.needEqChargeMsg_);\n }\n if (!returnObj['msg'].length) {\n returnObj['toVal'] = fromUnit.convertEqMass(fromVal, toUnit, molecularWeight, charge);\n }\n break;\n case 'eq|mol':\n if (!fromUnit.isEqMolCommensurable(toUnit)) {\n returnObj['msg'].push(`Sorry. ${fromUnitCode} cannot be ` +\n `converted to ${toUnitCode}.`);\n break;\n }\n if (!charge) {\n returnObj['msg'].push(Ucum.needEqChargeMsg_);\n break;\n }\n returnObj['toVal'] = fromUnit.convertEqMol(fromVal, toUnit, charge);\n break;\n case 'eq|mol|mass':\n if (!fromUnit.isEqMolMassCommensurable(toUnit)) {\n returnObj['msg'].push(`Sorry. ${fromUnitCode} cannot be ` +\n `converted to ${toUnitCode}.`);\n break;\n }\n if (!molecularWeight) {\n returnObj['msg'].push(Ucum.needEqWeightMsg_);\n }\n if (!charge) {\n returnObj['msg'].push(Ucum.needEqChargeMsg_);\n }\n if (!returnObj['msg'].length) {\n returnObj['toVal'] = fromUnit.convertEqMolMass(fromVal, toUnit, molecularWeight, charge);\n }\n break;\n default:\n returnObj['msg'].push(\"Unknown conversion type. No conversion was attempted.\");\n }\n if (returnObj['msg'].length > msgCountBeforeConvert) {\n // If one or more failure messages are pushed into returnObj['msg']\n // in the switch statement, mark the status as 'failed'.\n returnObj['status'] = 'failed';\n } else {\n // Set the return object to show success.\n returnObj['status'] = 'succeeded';\n returnObj['fromUnit'] = fromUnit;\n returnObj['toUnit'] = toUnit;\n }\n } // end if we have the from and to units\n }\n\n return returnObj;\n\n } // end convertUnitTo\n\n\n /**\n * Converts the given unit string into its base units, their exponents, and\n * a magnitude, and returns that data.\n * @param fromUnit the unit string to be converted to base units information\n * @param fromVal the number of \"from\" units to be converted\n * @returns an object with the properties:\n * 'status' indicates whether the result succeeded. The value will be one of:\n * 'succeeded': the conversion was successfully calculated (which can be\n * true even if it was already in base units);\n * 'invalid': fromUnit is not a valid UCUM code;\n * 'failed': the conversion could not be made (e.g., if it is an \"arbitrary\" unit);\n * 'error': if an error occurred (an input or programming error)\n * 'msg': an array of messages (possibly empty) if the string is invalid or\n * an error occurred, indicating the problem, or a suggestion of a\n * substitution such as the substitution of 'G' for 'Gauss', or\n * an empty array if no messages were generated. There can also be a\n * message that is just informational or warning.\n * 'magnitude': the new value when fromVal units of fromUnits is expressed in the base units.\n * 'fromUnitIsSpecial': whether the input unit fromUnit is a \"special unit\"\n * as defined in UCUM. This means there is some function applied to convert\n * between fromUnit and the base units, so the returned magnitude is likely not\n * useful as a scale factor for other conversions (i.e., it only has validity\n * and usefulness for the input values that produced it).\n * 'unitToExp': a map of base units in fromUnit to their exponent\n */\n convertToBaseUnits(fromUnit, fromVal) {\n let retObj = {};\n this._checkFromVal(fromVal, retObj);\n if (!retObj.status) { // could be set to 'error' by _checkFromVal\n let inputUnitLookup = this.getSpecifiedUnit(fromUnit, 'validate');\n retObj = {status: inputUnitLookup.status == 'valid' ? 'succeeded' : inputUnitLookup.status};\n let unit = inputUnitLookup.unit;\n retObj.msg = inputUnitLookup.retMsg || [];\n if (!unit) {\n if (inputUnitLookup.retMsg?.length == 0)\n retObj.msg.push('Could not find unit information for '+fromUnit);\n }\n else if (unit.isArbitrary_) {\n retObj.msg.push('Arbitrary units cannot be converted to base units or other units.');\n retObj.status = 'failed';\n }\n else if (retObj.status == 'succeeded') {\n let unitToExp = {};\n let dimVec = unit.dim_?.dimVec_\n let baseUnitString = '1';\n if (dimVec) {\n let dimVecIndexToBaseUnit = UnitTables.getInstance().dimVecIndexToBaseUnit_;\n for (let i=0, len=dimVec.length; i<len; ++i) {\n let exp = dimVec[i];\n if (exp) {\n unitToExp[dimVecIndexToBaseUnit[i]] = exp;\n baseUnitString += '.' + dimVecIndexToBaseUnit[i] + exp;\n }\n }\n }\n\n // The unit might have a conversion function, which has to be applied; we\n // cannot just assume unit_.magnitude_ is the magnitude in base units.\n let retUnitLookup = this.getSpecifiedUnit(baseUnitString, 'validate');\n // There should not be any error in retUnitLookup, unless there is a bug.\n let retUnit = retUnitLookup.unit;\n if (retUnitLookup.status !== 'valid') {\n retObj.msg.push('Unable construct base unit string; tried '+baseUnitString);\n retObj.status = 'error';\n }\n else {\n try {\n retObj.magnitude = retUnit.convertFrom(fromVal, unit);\n }\n catch (e) {\n retObj.msg.push(e.toString());\n retObj.status = 'error';\n }\n if (retObj.status == 'succeeded') {\n retObj.unitToExp = unitToExp;\n retObj.fromUnitIsSpecial = unit.isSpecial_;\n }\n }\n }\n }\n return retObj;\n }\n\n\n /**\n * Checks the given value as to whether it is suitable as a \"from\" value in a\n * unit conversion. If it is not, the responseObj will have its status set\n * to 'error' and a message added.\n * @param fromVal The value to check\n * @param responseObj the object that will be updated if the value is not\n * usable.\n */\n _checkFromVal(fromVal, responseObj) {\n if (fromVal === null || isNaN(fromVal) || (typeof fromVal !== 'number' &&\n !intUtils_.isNumericString(fromVal))) {\n responseObj.status = 'error';\n if (!responseObj.msg)\n responseObj.msg = [];\n responseObj.msg.push('No \"from\" value, or an invalid \"from\" value, ' +\n 'was specified.');\n }\n }\n\n\n /**\n * This method accepts a term and looks for units that include it as\n * a synonym - or that include the term in its name.\n *\n * @param theSyn the term to search for\n * @returns a hash with up to three elements:\n * 'status' contains the status of the request, which can be 'error',\n * 'failed' or succeeded';\n * 'msg' which contains a message for an error or if no units were found; and\n * 'units' which is an array that contains one hash for each unit found:\n * 'code' is the unit's csCode_\n * 'name' is the unit's name_\n * 'guidance' is the unit's guidance_\n *\n */\n checkSynonyms(theSyn) {\n let retObj = {} ;\n if (theSyn === undefined || theSyn === null) {\n retObj['status'] = 'error';\n retObj['msg'] = 'No term specified for synonym search.'\n }\n else {\n retObj = intUtils_.getSynonyms(theSyn);\n } // end if a search synonym was supplied\n\n return retObj ;\n\n } // end checkSynonyms\n\n\n /**\n * This method parses a unit string to get (or try to get) the unit\n * represented by the string. It returns an error message if no string was specified\n * or if any errors were encountered trying to get the unit.\n *\n * @param uName the expression/string representing the unit\n * @param valConv indicates what type of request this is for - a request to\n * validate (pass in 'validate') or a request to convert (pass in 'convert')\n * @param suggest a boolean to indicate whether or not suggestions are\n * requested for a string that cannot be resolved to a valid unit;\n * true indicates suggestions are wanted; false indicates they are not,\n * and is the default if the parameter is not specified;\n * @returns a hash containing:\n * 'status' will be 'valid' (uName is a valid UCUM code), 'invalid'\n * (the uStr is not a valid UCUM code, and substitutions or\n * suggestions may or may not be returned, depending on what was\n * requested and found); or 'error' (an input or programming error\n * occurred);\n * 'unit' the unit object (or null if there were problems creating the\n * unit);\n * 'origString' the possibly updated unit string passed in;\n * 'retMsg' an array of user messages (informational, error or warning) if\n * any were generated (IF any were generated, otherwise will be an\n * empty array); and\n * 'suggestions' is an array of 1 or more hash objects. Each hash\n * contains three elements:\n * 'msg' which is a message indicating what unit expression the\n * suggestions are for;\n * 'invalidUnit' which is the unit expression the suggestions are\n * for; and\n * 'units' which is an array of data for each suggested unit found.\n * Each array will contain the unit code, the unit name and the\n * unit guidance (if any).\n * The return hash will not contain a suggestions array if a valid unit\n * was found or if suggestions were not requested and found.\n */\n getSpecifiedUnit(uName, valConv, suggest) {\n\n if (suggest === undefined)\n suggest = false ;\n\n let retObj = {};\n retObj['retMsg'] = [];\n\n if (!uName) {\n retObj['retMsg'].push('No unit string specified.');\n }\n else {\n let utab = UnitTables.getInstance();\n uName = uName.trim();\n\n // go ahead and just try using the name as the code. This may or may not\n // work, but if it does, it cuts out a lot of parsing.\n let theUnit = utab.getUnitByCode(uName);\n\n // If we found it, set the returned unit string to what was passed in;\n // otherwise try parsing as a unit string\n if (theUnit) {\n retObj['unit'] = theUnit ;\n retObj['origString'] = uName;\n }\n else {\n try {\n let resp = this.uStrParser_.parseString(uName, valConv, suggest);\n retObj['unit'] = resp[0];\n retObj['origString'] = resp[1];\n if (resp[2])\n retObj['retMsg'] = resp[2];\n retObj['suggestions'] = resp[3];\n }\n catch (err) {\n console.log(`Unit requested for unit string ${uName}.` +\n 'request unsuccessful; error thrown = ' + err.message);\n retObj['retMsg'].unshift(`${uName} is not a valid unit. ` +\n `${err.message}`);\n }\n } // end if the unit was not found as a unit name\n } // end if a unit expression was specified\n\n // Set the status field\n if (!retObj.unit) {\n // No unit was found; check whether origString has a value\n retObj.status = !retObj.origString ? 'error' : 'invalid';\n }\n else {\n // Check whether substitutions were made to the unit string in order to\n // find the unit\n retObj.status = retObj.origString === uName ? 'valid': 'invalid';\n }\n\n return retObj;\n\n } // end getSpecifiedUnit\n\n\n /**\n * This method retrieves a list of units commensurable, i.e., that can be\n * converted from and to, a specified unit. Returns an error if the \"from\"\n * unit cannot be found. If necessary, you can filter the list of units by\n * specifying a list of unit categories that should be in the resulting list.\n *\n * @param {string} fromName - the name/unit string of the \"from\" unit\n * @param {string[] | null} [categoryList] - the list of unit categories;\n * this parameter is optional, defaults to null if not specified;\n * possible list values: 'Clinical', 'Nonclinical', 'Obsolete', 'Constant'\n * @returns an array containing two elements;\n * first element is the list of commensurable units if any were found;\n * second element is an error message if the \"from\" unit is not found\n */\n commensurablesList(fromName, categoryList = null) {\n\n let retMsg = [];\n let commUnits = null ;\n let parseResp = this.getSpecifiedUnit(fromName, 'validate', false);\n let fromUnit = parseResp['unit'];\n if (parseResp['retMsg'].length > 0)\n retMsg = parseResp['retMsg'] ;\n if (!fromUnit) {\n retMsg.push(`Could not find unit ${fromName}.`);\n }\n else {\n let dimVec = null ;\n let fromDim = fromUnit.getProperty('dim_');\n if (!fromDim) {\n retMsg.push('No commensurable units were found for ' + fromName) ;\n }\n else {\n try {\n dimVec = fromDim.getProperty('dimVec_');\n }\n catch (err) {\n retMsg.push(err.message);\n if (err.message ===\n \"Dimension does not have requested property(dimVec_)\")\n dimVec = null;\n }\n if (dimVec) {\n let utab = UnitTables.getInstance();\n commUnits = utab.getUnitsByDimension(dimVec);\n if (categoryList) {\n commUnits = commUnits.filter((item) => {\n return categoryList.indexOf(item.category_) !== -1;\n });\n }\n }\n } // end if the from unit has a dimension vector\n } // end if we found a \"from\" unit\n return [commUnits , retMsg];\n } // end commensurablesList\n\n} // end UcumLhcUtils class\n\n\n/**\n * This function exists ONLY until the original UcumLhcUtils constructor\n * is called for the first time. It's defined here in case getInstance\n * is called before the constructor. This calls the constructor.\n *\n * The constructor redefines the getInstance function to return the\n * singleton UcumLhcUtils object. This is based on the UnitTables singleton\n * implementation; see more detail in the UnitTables constructor description.\n *\n * NO LONGER TRUE - not implemented as a singleton. This method retained to\n * avoid problems with calls to it that exist throughout the code.\n *\n * @return the (formerly singleton) UcumLhcUtils object.\n */\nUcumLhcUtils.getInstance = function(){\n return new UcumLhcUtils();\n} ;\n"],"mappings":";;;;;;AAOA,IAAAA,aAAA,GAAAC,OAAA;AAIA,IAAAC,SAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAoD,SAAAE,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,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,10 +11,7 @@ exports.UnitTables = exports.UcumLhcUtils = exports.Ucum = void 0;
11
11
  * those classes within the library.
12
12
  */
13
13
 
14
- var Ucum = require("./config.js").Ucum;
15
- exports.Ucum = Ucum;
16
- var UcumLhcUtils = require("./ucumLhcUtils.js").UcumLhcUtils;
17
- exports.UcumLhcUtils = UcumLhcUtils;
18
- var UnitTables = require("./unitTables.js").UnitTables;
19
- exports.UnitTables = UnitTables;
14
+ var Ucum = exports.Ucum = require("./config.js").Ucum;
15
+ var UcumLhcUtils = exports.UcumLhcUtils = require("./ucumLhcUtils.js").UcumLhcUtils;
16
+ var UnitTables = exports.UnitTables = require("./unitTables.js").UnitTables;
20
17
  //# sourceMappingURL=ucumPkg.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ucumPkg.js","names":["Ucum","require","exports","UcumLhcUtils","UnitTables"],"sources":["../source/ucumPkg.js"],"sourcesContent":["/**\n * This exports definitions for ucum classes that need references to them\n * available to the demo code. The actual code will be in the ucumPkg\n * library found in the dist directory. This file provides the hooks to\n * those classes within the library.\n */\n\nexport var Ucum = require(\"./config.js\").Ucum;\nexport var UcumLhcUtils = require(\"./ucumLhcUtils.js\").UcumLhcUtils;\nexport var UnitTables = require(\"./unitTables.js\").UnitTables;"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEO,IAAIA,IAAI,GAAGC,OAAO,CAAC,aAAa,CAAC,CAACD,IAAI;AAACE,OAAA,CAAAF,IAAA,GAAAA,IAAA;AACvC,IAAIG,YAAY,GAAGF,OAAO,CAAC,mBAAmB,CAAC,CAACE,YAAY;AAACD,OAAA,CAAAC,YAAA,GAAAA,YAAA;AAC7D,IAAIC,UAAU,GAAGH,OAAO,CAAC,iBAAiB,CAAC,CAACG,UAAU;AAACF,OAAA,CAAAE,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"file":"ucumPkg.js","names":["Ucum","exports","require","UcumLhcUtils","UnitTables"],"sources":["../source/ucumPkg.js"],"sourcesContent":["/**\n * This exports definitions for ucum classes that need references to them\n * available to the demo code. The actual code will be in the ucumPkg\n * library found in the dist directory. This file provides the hooks to\n * those classes within the library.\n */\n\nexport var Ucum = require(\"./config.js\").Ucum;\nexport var UcumLhcUtils = require(\"./ucumLhcUtils.js\").UcumLhcUtils;\nexport var UnitTables = require(\"./unitTables.js\").UnitTables;"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEO,IAAIA,IAAI,GAAAC,OAAA,CAAAD,IAAA,GAAGE,OAAO,CAAC,aAAa,CAAC,CAACF,IAAI;AACtC,IAAIG,YAAY,GAAAF,OAAA,CAAAE,YAAA,GAAGD,OAAO,CAAC,mBAAmB,CAAC,CAACC,YAAY;AAC5D,IAAIC,UAAU,GAAAH,OAAA,CAAAG,UAAA,GAAGF,OAAO,CAAC,iBAAiB,CAAC,CAACE,UAAU","ignoreList":[]}