@lhncbc/ucum-lhc 7.1.5 → 7.1.8

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.
@@ -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,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,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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;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,EAAEC,OAAO,EAAEC,UAAU,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAE;IAC7D,IAAI;MAACtB,OAAO,GAAG,KAAK;MAAEuB,eAAe,GAAG,IAAI;MAAEC,MAAM,GAAG;IAAI,CAAC,GAAGF,OAAO;;IAEtE;IACA,IAAIG,SAAS,GAAG;MACd,QAAQ,EAAE,QAAQ;MAClB,OAAO,EAAE,IAAI;MACb,KAAK,EAAE;IACT,CAAC;IAED,IAAIN,YAAY,EAAE;MAChBA,YAAY,GAAGA,YAAY,CAACO,IAAI,CAAC,CAAC;IACpC;IACA,IAAI,CAACP,YAAY,IAAIA,YAAY,IAAI,EAAE,EAAE;MACvCM,SAAS,CAAC,QAAQ,CAAC,GAAG,OAAO;MAC7BA,SAAS,CAAC,KAAK,CAAC,CAACE,IAAI,CAAC,sCAAsC,CAAC;IAC/D;IACA,IAAI,CAACC,aAAa,CAACR,OAAO,EAAEK,SAAS,CAAC;IACtC,IAAIJ,UAAU,EAAE;MACdA,UAAU,GAAGA,UAAU,CAACK,IAAI,CAAC,CAAC;IAChC;IACA,IAAI,CAACL,UAAU,IAAIA,U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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 */\n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AAiB,CAAC,CAACuB,UAAU;AACtD,IAAIC,UAAU,GAAGxB,OAAO,CAAC,iBAAiB,CAAC,CAACwB,UAAU;AAItD;AACA;AACA;AACO,MAAMC,YAAY,CAAC;EAExB;AACF;AACA;AACA;AACA;EACEC,WAAWA,CAAA,EAAG;IAEZ,IAAIH,UAAU,CAACI,WAAW,CAAC,CAAC,CAACC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE;MAE/C;MACAC,0BAAY,CAACC,YAAY,CAAC,CAAC;IAC7B;;IAEA;IACA;IACA,IAAI,CAACC,WAAW,GAAGP,UAAU,CAACG,WAAW,CAAC,CAAC;;IAE3C;IACA,IAAI,CAACK,aAAa,GAAIT,UAAU,CAACI,WAAW,CAAC,CAAC,CAACM,qBAAqB,CAAC,CAAC;EACxE,CAAC,CAAC;;EAGF;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,iBAAiBA,CAACC,GAAG,EAAE;IACrB,IAAIA,GAAG,KAAKC,SAAS,EACnBD,GAAG,GAAG,IAAI;IACZ,IAAI,CAACJ,WAAW,CAACG,iBAAiB,CAACC,GAAG,CAAC;EACzC;;EAGA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,wBAAwBA,CAACF,GAAG,EAAE;IAC5B,IAAIA,GAAG,KAAKC,SAAS,EACnBD,GAAG,GAAG,IAAI;IACZ,IAAI,CAACJ,WAAW,CAACM,wBAAwB,CAACF,GAAG,CAAC;EAChD;;EAGA;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;EACEG,kBAAkBA,CAACC,IAAI,EAAEC,OAAO,EAAEC,OAAO,EAAE;IAEzC,IA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B,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,EAAEC,OAAO,EAAEC,UAAU,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAE;IAC7D,IAAI;MAACtB,OAAO,GAAG,KAAK;MAAEuB,eAAe,GAAG,IAAI;MAAEC,MAAM,GAAG;IAAI,CAAC,GAAGF,OAAO;;IAEtE;IACA,IAAIG,SAAS,GAAG;MACd,QAAQ,EAAE,QAAQ;MAClB,OAAO,EAAE,IAAI;MACb,KAAK,EAAE;IACT,CAAC;IAED,IAAIN,YAAY,EAAE;MAChBA,YAAY,GAAGA,YAAY,CAACO,IAAI,CAAC,CAAC;IACpC;IACA,IAAI,CAACP,YA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C;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":[]}
@@ -11,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":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ucumXmlDocument.js","names":["Prefix","require","PrefixTables","Unit","UnitString","UnitTables","packArray","jsonfile","xmldoc","fs","essenceFile_","xmlInput_","UcumXmlDocument","constructor","data","readFileSync","XmlDocument","moleCodes_","equivCodes_","holdThis","prototype","exports","Error","self","getInstance","parseXml","parsePrefixes","childrenNamed","parseBaseUnits","parseUnitStrings","writeJsonFile","writeVersionText","prefixes","plen","length","p","curPfx","attrs","attr","Code","CODE","childNamed","val","pValNode","parseFloat","ptab","isDefined","newPref","add","unitNodes","blen","utab","b","curBUnit","dim","newUnit","addUnit","unitStrings","uStrParser","stopNow","alen","a","haveUnit","curUA","toUpperCase","sym","symVal","replace","trim","symI","toString","compressed","sub","sup","isMetric","isArbitrary","class","valNode","indexOf","isSpecial","funcNode","name","value","slashPos","ar","split","Math","pow","UNIT","substr","exp","parseInt","console","log","PI","retObj","parseString","ret","retString","retMsg","getProperty","newMag","err","message","uList","printUnits","writeFileSync","encoding","mode","flag","licenseText","pfxTabs","pfxArray","allPrefixesByCode","uTabs","uArray","allUnitsByDef","defsHash","dt","Date","spaces","rootNode","versionNum","version","revNum","revision","rootString","dateIdx","nextDolIdx","revDate","versionText"],"sources":["../source/ucumXmlDocument.js"],"sourcesContent":["/**\n * This class handles opening, reading and parsing the XML file of ucum\n * definitions (prefixes, base units, and unit atoms).\n *\n * @author Lee Mericle\n *\n */\nvar Prefix = require(\"./prefix.js\").Prefix;\nvar PrefixTables = require(\"./prefixTables.js\").PrefixTables;\nvar Unit = require(\"./unit.js\").Unit;\nvar UnitString = require(\"./unitString.js\").UnitString;\nvar UnitTables = require('./unitTables.js').UnitTables;\nvar packArray = require('./jsonArrayPack.js').packArray;\nvar jsonfile = require('jsonfile');\n\nvar xmldoc = require('xmldoc');\nvar fs = require('fs');\n\nvar essenceFile_ = '../data/ucum-essence.xml';\n\n/**\n * The full xml document\n * @type XmlDocument\n */\nvar xmlInput_ = null;\n\nexport class UcumXmlDocument {\n\n\n /**\n * Constructor. This reads the XML document (essenceFile_) into the\n * xmldoc object, which is an object used by the xmldoc class available\n * from GitHub - https://github.com/nfarina/xmldoc. The object provides\n * methods to read the file and access its contents.\n *\n */\n constructor() {\n // read the XML file and create an xmlDocument object from it.\n let data = fs.readFileSync(essenceFile_);\n xmlInput_ = new xmldoc.XmlDocument(data);\n\n // Array of unit codes in the ucum-essence.xml file that indicate a\n // mole based unit. The moleExp_ attribute for these units needs to be\n // set, but there doesn't seem to be an algorithmic way to find these.\n // Creation of unit objects after this file is processed will pick up\n // the moleExp_ value from the base mole unit, but the ones defined in\n // this file will not necessarily do that.\n this.moleCodes_ = ['mol', 'osm', 'kat', 'U' ];\n // Works similarly to the moleCodes_ array, but for units that represents\n // equivalent units. For unit codes in the equivCodes_ array, an equivalentExp_ \n // attribute flag will be set to 1. \n this.equivCodes_ = ['eq'];\n\n // Make this a singleton. See UnitTables constructor for details.\n\n let holdThis = UcumXmlDocument.prototype;\n UcumXmlDocument = function () {\n throw (new Error('UcumXmlDocument is a Singleton. ' +\n 'Use UcumXmlDocument.getInstance() instead.'));\n };\n if (exports)\n exports.UcumXmlDocument = UcumXmlDocument;\n UcumXmlDocument.prototype = holdThis;\n\n let self = this ;\n UcumXmlDocument.getInstance = function(){return self} ;\n }\n\n\n /**\n * This method controls parsing of the XML into objects used by this\n * program. It uses separate methods to parse the prefixes, the\n * base units, and the units.\n *\n * @returns nothing\n */\n parseXml() {\n\n this.parsePrefixes(xmlInput_.childrenNamed(\"prefix\"));\n this.parseBaseUnits(xmlInput_.childrenNamed(\"base-unit\")) ;\n this.parseUnitStrings(xmlInput_.childrenNamed(\"unit\")) ;\n\n // Create or replace the json file of the prefix and unit definitions\n this.writeJsonFile();\n this.writeVersionText();\n\n }\n\n\n /**\n * Creates prefix objects from the xml prefix nodes passed in and gets\n * them added to the prefix tables.\n *\n * @params prefixes the array of prefix nodes from the xml file, in the\n * order in which the nodes are defined in that file.\n *\n * @returns nothing\n */\n parsePrefixes(prefixes) {\n\n\n let plen = prefixes.length ;\n\n for (let p = 0; p < plen; p++) {\n let curPfx = prefixes[p];\n let attrs = {} ;\n\n attrs[\"code_\"] = curPfx.attr.Code;\n attrs[\"ciCode_\"] = curPfx.attr.CODE;\n attrs[\"name_\"] = curPfx.childNamed('name').val;\n attrs[\"printSymbol_\"] = curPfx.childNamed('printSymbol').val;\n\n // Set the prefix value. If there is a <sup> element in the\n // value node, then this is a base 10 based prefix (10 to the x power).\n // Set the value to 10 taken to the indicated power.\n // Otherwise this is not 10 based and the value contains the\n // actual value for the prefix.\n let pValNode = curPfx.childNamed('value') ;\n attrs[\"value_\"] = null;\n attrs[\"exp_\"] = pValNode.childNamed('sup');\n if (attrs[\"exp_\"] != null) {\n attrs[\"exp_\"] = attrs[\"exp_\"].val;\n // Use parseFloat('1eSOMETHING') instead of Math.pow() to avoid\n // small number changes like 1.0000000000000001e-21. See LF-2830.\n // attrs[\"value_\"] = Math.pow(10, attrs[\"exp_\"]);\n attrs[\"value_\"] = parseFloat(`1e${attrs[\"exp_\"]}`);\n }\n else {\n attrs[\"value_\"] = pValNode.val;\n attrs[\"exp_\"] = null;\n }\n\n // Make sure the prefix has not already been created. If it hasn't,\n // create the prefix object and then add it to the prefix tables.\n let ptab = PrefixTables.getInstance();\n if (ptab.isDefined(attrs[\"code_\"])) {\n throw(new Error('Prefix constructor called for prefix already ' +\n `defined; code = ${attrs[\"code_\"]}`));\n }\n else {\n let newPref = new Prefix(attrs);\n ptab.add(newPref);\n }\n }\n } // end parsePrefixes\n\n\n /**\n * Creates base unit objects from the xml nodes passed in and adds\n * them to the unit tables.\n *\n * @params unitNodes the array of base unit nodes from the xml file, in the\n * order in which the nodes are defined in that file. (Order is important\n * for all units).\n *\n * @returns nothing\n */\n parseBaseUnits(unitNodes) {\n let blen = unitNodes.length ;\n let utab = UnitTables.getInstance() ;\n for (let b = 0; b < blen; b++) {\n let curBUnit = unitNodes[b];\n let attrs = {} ;\n attrs['isBase_'] = true ;\n attrs['name_'] = curBUnit.childNamed('name').val ;\n attrs['csCode_'] = curBUnit.attr.Code ;\n attrs['ciCode_'] = curBUnit.attr.CODE ;\n attrs['property_'] = curBUnit.childNamed('property').val;\n attrs['variable_'] = curBUnit.attr.dim ;\n attrs['printSymbol_'] = curBUnit.childNamed('printSymbol').val;\n attrs['dim_'] = b ;\n attrs['source_'] = 'UCUM';\n let newUnit = new Unit(attrs);\n utab.addUnit(newUnit) ;\n }\n } // end parseBaseUnits\n\n\n /**\n * Creates non-base unit objects from the xml nodes passed in and adds\n * them to the unit tables.\n *\n * @params unitStrings the array of non-base unit nodes from the xml file, in the\n * order in which the nodes are defined in that file. (Order is important\n * for all units).\n *\n * @returns nothing\n */\n parseUnitStrings(unitStrings) {\n\n let utab = UnitTables.getInstance() ;\n let uStrParser = UnitString.getInstance();\n let stopNow = false ;\n let alen = unitStrings.length ;\n for (let a = 0; a < alen && !stopNow; a++) {\n let haveUnit = true;\n let curUA = unitStrings[a];\n let attrs = {};\n attrs['isBase_'] = false;\n attrs['source_'] = 'UCUM';\n attrs['name_'] = curUA.childNamed('name').val;\n attrs['csCode_'] = curUA.attr.Code;\n if (curUA.attr.CODE)\n attrs['ciCode_'] = curUA.attr.CODE;\n else\n attrs['ciCode_'] = curUA.attr.Code.toUpperCase();\n attrs['property_'] = curUA.childNamed('property').val;\n if (curUA.childNamed('printSymbol')) {\n let sym = curUA.childNamed('printSymbol') ;\n let symVal = sym.val;\n symVal = symVal.replace(/\\n/g, \"\");\n symVal = symVal.trim();\n let symI = sym.childNamed('i');\n if (symI)\n //symVal = '<i>' + symI.val + '</>';\n symVal = symI.toString({compressed:true});\n let sub = sym.childNamed('sub');\n let sup = sym.childNamed('sup');\n if (sub)\n symVal += sub.toString({compressed:true});\n if (sup)\n symVal += sup.toString({compressed:true});\n\n attrs['printSymbol_'] = symVal;\n }\n if (curUA.attr.isMetric === \"yes\")\n attrs['isMetric_'] = true ;\n else\n attrs['isMetric_'] = false ;\n if (curUA.attr.isArbitrary)\n attrs['isArbitrary_'] = true ;\n else\n attrs['isArbitrary_'] = false ;\n if (curUA.attr.class) {\n attrs['class_'] = curUA.attr.class;\n }\n let valNode = curUA.childNamed('value');\n // Note: This currently works as a boolean flag,\n // but it should be used to represent the dimensionality\n // of the unit as an integer instead.\n if (this.moleCodes_.indexOf(curUA.attr.Code) !== -1)\n attrs['moleExp_'] = 1;\n else\n attrs['moleExp_'] = 0;\n // Adds a flag similar to how moleExp_ works, but for units \n // that are equivalent. Note that ideally this should also\n // take values other than 1 or 0, but for now it is a boolean \n // flag.\n if (this.equivCodes_.indexOf(curUA.attr.Code) !== -1) {\n attrs['equivalentExp_'] = 1;\n }\n\n\n // Process special units\n if (curUA.attr.isSpecial) {\n attrs['isSpecial_'] = curUA.attr.isSpecial === \"yes\";\n let funcNode = valNode.childNamed('function');\n attrs['cnv_'] = funcNode.attr.name;\n attrs['csUnitString_'] = funcNode.attr.Unit;\n if (attrs['csUnitString_'] === '1') {\n attrs['baseFactor_'] = 1 ;\n }\n else if (attrs['csCode_'] === '[pH]') {\n attrs['baseFactor_'] = parseFloat(funcNode.attr.value) ;\n }\n else {\n let slashPos = attrs['csUnitString_'].indexOf('/');\n let ar = [];\n\n // unit string = K/9 or K/4 or m2/s4/Hz\n if (slashPos >= 0) {\n ar = attrs['csUnitString_'].split('/');\n }\n // unit string = K/9 or K/4\n if ((slashPos >= 0) && (ar.length === 2)) {\n attrs['csUnitString_'] = ar[0];\n attrs['baseFactor_'] = parseFloat(funcNode.attr.value/ar[1]);\n }\n // unit string = 10*-5.Pa\n else if (attrs['csCode_'] === 'B[SPL]') {\n attrs['baseFactor_'] = Math.pow(10, -5) * 2 ;\n attrs['csUnitString_'] = \"Pa\" ;\n }\n // unit string = m1/s4/Hz, K, deg, V, mV, uV, nV, W, kW\n else {\n attrs['baseFactor_'] = parseFloat(funcNode.attr.value);\n }\n } // end if the unit string is not 1\n } // end if the unit is special\n\n else {\n // what I'm calling the unit string is the string that defines the\n // unit based on other units, e.g., rad2 (radian squared) to define\n // a steradian unit. It's not necessarily a proper base unit, although\n // it ultimately builds on base units.\n attrs['csUnitString_'] = valNode.attr.Unit;\n attrs['ciUnitString_'] = valNode.attr.UNIT;\n\n // what I'm calling the factor here (string and number versions)\n // is the magnitude used in conjunction with the unit string to define\n // the new unit, e.g., 3 for a yard that is based in the definition\n // of feet.\n\n attrs['baseFactorStr_'] = valNode.attr.value;\n if (attrs['csCode_'] === '[pi]')\n attrs['baseFactor_'] = parseFloat(attrs['baseFactorStr_']);\n else if (valNode.childNamed('sup')) {\n attrs['baseFactor_'] = parseFloat(valNode.attr.value) ;\n }\n else {\n attrs['baseFactor_'] = parseFloat(valNode.val);\n }\n } // end if this is not a special unit\n\n // Arbitrary units are defined in the UCUM spec as \"not of any\n // specific dimension and are not commensurable with any other\n // unit\" (3.2.24). All arbitrary units in the units definition\n // XML file currently have a unit string of 1 and a base factor of 1\n // except the \"international unit\" with a code of [IU]. Its\n // unit string is the \"international unit\" with a code of [iU],\n // which is also an arbitrary unit - with a unit string of 1.\n // So I am assuming [IU] is just another code for the same unit.\n if (attrs['isArbitrary_'] === true) {\n attrs['magnitude_'] = 1;\n attrs['dim_'] = null;\n }\n\n // units with class = \"dimless\" don't have dimension arrays.\n // They're things like the number pi or the number 10 or percent.\n // Haven't figured out how to handle them yet.\n else if (attrs['class_'] === 'dimless' ||\n attrs['csCode_'] === 'mol') {\n attrs['dim_'] = null ;\n // figure the magnitude based on the unit string\n // if it's 1, the magnitude is the value specified for\n // the base factor, e.g., 3.141592653589793238462 ... for pi\n if (attrs['csUnitString_'] === '1') {\n attrs['magnitude_'] = attrs['baseFactor_'];\n }\n // else if the unit string starts with 10*, the magnitude is\n // 10 to the power specified following 10* e.g., unit = 10*-2\n // for the \"%\" unit. Except for the mole, which is that\n // multiplied by the base factor, which in this case (only,\n // I think) is not 1.\n else if (attrs['csUnitString_'].substr(0,3) == \"10*\") {\n let exp = parseInt(attrs['csUnitString_'].substr(3));\n attrs['magnitude_'] = Math.pow(10, exp) ;\n if (attrs['baseFactor_'] !== 1) {\n attrs['magnitude_'] *= attrs['baseFactor_'];\n }\n }\n // else I don't know what it is.\n else {\n attrs['defError_'] = true ;\n console.log('unexpected dimless unit definition, unit code ' +\n 'is ' + attrs['csCode_']) ;\n }\n } // end if this is a unit with class = dimless\n\n // Handle carat of gold alloys - which doesn't get a dimension\n //\n else if (attrs['csCode_'] === \"[car_Au]\") {\n attrs['magnitude_'] = 1/24 ;\n attrs['dim_'] = null ;\n }\n else {\n\n // Make sure there's a unit string to base the new unit on. There\n // should be, but I'm just checking here to make sure. And omit\n // ones with a unit string of 1. That won't do us any good.\n if (attrs['csUnitString_'] && attrs['csUnitString_'] !== '1' &&\n attrs['csUnitString_'] !== 1) {\n\n haveUnit = false;\n // Handle some special cases\n // 1. the Oersted unit, whose string is /[pi].A/m and whose\n // value is 250. Set the baseFactor to 250/[pi] and\n // the unit string to A/m\n if (attrs['csCode_'] === 'Oe') {\n attrs['baseFactor_'] = 250 / Math.PI;\n attrs['csUnitString_'] = \"A/m\"\n }\n // 2. Strings that start with '/'. Set the function to\n // the inverse function and trim the '/' off the front\n // of the string.\n else if (attrs['csUnitString_'][0] === '/') {\n attrs['cnv_'] = 'inv';\n attrs['csUnitString_'] = attrs['csUnitString_'].substr(1);\n }\n // 3. the Svedberg unit, whose string is 10*-13.s. Set the\n // base factor to 10*-13 and the unit string to s.\n else if (attrs['csCode_'] === '[S]') {\n attrs['baseFactor_'] = Math.pow(10, -13);\n attrs['csUnitString_'] = 's';\n }\n // 4. permeability of vaccuum - code [mu_0], unit given is\n // 4.[pi].10*-7.N/A2\n else if (attrs['csCode_'] === '[mu_0]') {\n attrs['baseFactor_'] = 4 * Math.PI * Math.pow(10, -7);\n attrs['csUnitString_'] = 'N/A2';\n }\n // The unit string parser will use the unit(s) named in the\n // string to create a new unit with the appropriate dimension\n // object and magnitude before it's multiplied by the one\n // specified in the input node.\n try {\n let retObj = uStrParser.parseString(attrs['csUnitString_'],\n 'validate', false);\n let ret = retObj[0];\n let retString = retObj[1];\n let retMsg = retObj[2];\n\n // Get the dimension object and magnitude (and adjust by\n // specified magnitude factor) from the unit created and\n // assign them to the attributes we'll use to create the\n // unit for this listing.\n if (ret) {\n attrs['dim_'] = ret.getProperty('dim_');\n let newMag = ret.getProperty('magnitude_');\n newMag *= attrs['baseFactor_'];\n attrs['magnitude_'] = newMag;\n haveUnit = true ;\n }\n // if there's no unit, report an error\n else {\n attrs['defError_'] = true;\n console.log(`unit definition error; code = ${attrs['csCode_']}; `+\n `msg = ${retMsg}`);\n attrs['dim_'] = null;\n attrs['magnitude_'] = null;\n }\n }\n catch(err) {\n console.log('error thrown from unit parsing code for unit name ' +\n attrs['name_'] + '\\n' + err.message);\n stopNow = true;\n }\n } // end if there is a unit string to parse\n } // end if this is not a dimless unit\n\n if (haveUnit) {\n // Now create the unit we want based on the attributes we've\n // accumulated from the xml input and from figuring the dimension\n // and magnitude. Add it to the unit tables\n let newUnit = new Unit(attrs);\n utab.addUnit(newUnit);\n\n // for now, create a list of the units created and save it to a file\n // for debugging. This is a temporary file.\n let uList = utab.printUnits();\n fs.writeFileSync('UnitsList.txt', uList,\n {encoding: 'utf8', mode: 0o666, flag: 'w'});\n } // end if have a parsed unit\n } // end for a => - to alen\n\n } // end parseUnitStrings\n\n\n /**\n * This writes out the ucumDefs data file, which contains all prefixes and\n * units (base units and others) read and parsed from the XML file.\n *\n * This creates or replace the file \"ucumDefs.json\" in the data directory.\n */\n writeJsonFile() {\n\n let licenseText = \"The following data (prefixes and units) was generated \" +\n \"by the UCUM LHC code from the UCUM data and selected \" +\n \"LOINC combinations of UCUM units. The license for \" +\n \"the UCUM LHC code (demo and library code as well as \" +\n \"the combined units) is located at \" +\n \"https://github.com/lhncbc/ucum-lhc/blob/LICENSE.md.\" ;\n let pfxTabs = PrefixTables.getInstance() ;\n let pfxArray = pfxTabs.allPrefixesByCode();\n let uTabs = UnitTables.getInstance();\n let uArray = uTabs.allUnitsByDef();\n\n let defsHash = { 'license' : licenseText,\n 'prefixes' : packArray(pfxArray),\n 'units' : packArray(uArray)};\n let dt = new Date();\n jsonfile.writeFileSync('../data/ucumDefs.json',\n defsHash,\n {spaces: 2, encoding: 'utf8', mode: 0o644, flag: 'w'});\n jsonfile.writeFileSync('../data/ucumDefs.min.json',\n defsHash,\n {encoding: 'utf8', mode: 0o644, flag: 'w'});\n } // end writeJsonFile\n\n /**\n * This writes out the ucumDefs data file, which contains all prefixes and\n * units (base units and others) read and parsed from the XML file.\n *\n * This creates the file in the data directory and appends the\n * current Date object value to \"ucumDefs\" so that this does not run\n * into problems with a previously existing file.\n */\n writeVersionText() {\n\n let rootNode = xmlInput_;\n let versionNum = rootNode.attr.version;\n let revNum = rootNode.attr.revision;\n revNum = revNum.replace('$Revision:', '');\n revNum = revNum.replace('$', '');\n revNum = revNum.trim();\n let rootString = rootNode.toString({compressed:true});\n let dateIdx = rootString.indexOf('$Date:');\n rootString = rootString.substr(dateIdx + 6);\n let nextDolIdx = rootString.indexOf('$');\n let revDate = rootString.substr(0, nextDolIdx ).replace('$','');\n revDate = revDate.trim();\n let versionText = `version ${versionNum}, revision ${revNum}, ` +\n `dated ${revDate}`;\n\n fs.writeFileSync('../data/ucumEssenceVersion.txt',\n versionText, {encoding: 'utf8', mode: 0o644, flag: 'w'});\n } // end writeVersionText\n\n} // end UcumXmlDocument\n\n\n/**\n * This function exists ONLY until the original UcumXmlDocument 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 UcumXmlDocument object. This is based on the UnitTables singleton\n * implementation; see more detail in the UnitTables constructor description.\n *\n * @return the singleton UcumXmlDocument object.\n */\nUcumXmlDocument.getInstance = function(){\n return new UcumXmlDocument();\n}\n\n// Perform the first request for the document object, to get the\n// getInstance method set.\nUcumXmlDocument.getInstance();\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIA,MAAM,GAAGC,OAAO,CAAC,aAAa,CAAC,CAACD,MAAM;AAC1C,IAAIE,YAAY,GAAGD,OAAO,CAAC,mBAAmB,CAAC,CAACC,YAAY;AAC5D,IAAIC,IAAI,GAAGF,OA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U,CAAChD,OAAO,CAAC,QAAQ,CAAC;IAC1CgD,UAAU,GAAGA,UAAU,CAACrC,MAAM,CAACsC,OAAO,GAAG,CAAC,CAAC;IAC3C,IAAIC,UAAU,GAAGF,UAAU,CAAChD,OAAO,CAAC,GAAG,CAAC;IACxC,IAAImD,OAAO,GAAGH,UAAU,CAACrC,MAAM,CAAC,CAAC,EAAEuC,UAAW,CAAC,CAAC7D,OAAO,CAAC,GAAG,EAAC,EAAE,CAAC;IAC/D8D,OAAO,GAAGA,OAAO,CAAC7D,IAAI,CAAC,CAAC;IACxB,IAAI8D,WAAW,GAAI,WAAUR,UAAW,cAAaE,MAAO,IAAG,GACrD,SAAQK,OAAQ,EAAC;IAE3BxH,EAAE,CAACiG,aAAa,CAAC,gCAAgC,EAC/CwB,WAAW,EAAE;MAACvB,QAAQ,EAAE,MAAM;MAAEC,IAAI,EAAE,KAAK;MAAEC,IAAI,EAAE;IAAG,CAAC,CAAC;EAC5D,CAAC,CAAC;AAEJ,CAAC,CAAC;;AAGF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVAxF,OAAA,CAAAT,eAAA,GAAAA,eAAA;AAWAA,eAAe,CAACY,WAAW,GAAG,YAAU;EACtC,OAAO,IAAIZ,eAAe,CAAC,CAAC;AAC9B,CAAC;;AAED;AACA;AACAA,eAAe,CAACY,WAAW,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"ucumXmlDocument.js","names":["Prefix","require","PrefixTables","Unit","UnitString","UnitTables","packArray","jsonfile","xmldoc","fs","essenceFile_","xmlInput_","UcumXmlDocument","constructor","data","readFileSync","XmlDocument","moleCodes_","equivCodes_","holdThis","prototype","exports","Error","self","getInstance","parseXml","parsePrefixes","childrenNamed","parseBaseUnits","parseUnitStrings","writeJsonFile","writeVersionText","prefixes","plen","length","p","curPfx","attrs","attr","Code","CODE","childNamed","val","pValNode","parseFloat","ptab","isDefined","newPref","add","unitNodes","blen","utab","b","curBUnit","dim","newUnit","addUnit","unitStrings","uStrParser","stopNow","alen","a","haveUnit","curUA","toUpperCase","sym","symVal","replace","trim","symI","toString","compressed","sub","sup","isMetric","isArbitrary","class","valNode","indexOf","isSpecial","funcNode","name","value","slashPos","ar","split","Math","pow","UNIT","substr","exp","parseInt","console","log","PI","retObj","parseString","ret","retString","retMsg","getProperty","newMag","err","message","uList","printUnits","writeFileSync","encoding","mode","flag","licenseText","pfxTabs","pfxArray","allPrefixesByCode","uTabs","uArray","allUnitsByDef","defsHash","dt","Date","spaces","rootNode","versionNum","version","revNum","revision","rootString","dateIdx","nextDolIdx","revDate","versionText"],"sources":["../source/ucumXmlDocument.js"],"sourcesContent":["/**\n * This class handles opening, reading and parsing the XML file of ucum\n * definitions (prefixes, base units, and unit atoms).\n *\n * @author Lee Mericle\n *\n */\nvar Prefix = require(\"./prefix.js\").Prefix;\nvar PrefixTables = require(\"./prefixTables.js\").PrefixTables;\nvar Unit = require(\"./unit.js\").Unit;\nvar UnitString = require(\"./unitString.js\").UnitString;\nvar UnitTables = require('./unitTables.js').UnitTables;\nvar packArray = require('./jsonArrayPack.js').packArray;\nvar jsonfile = require('jsonfile');\n\nvar xmldoc = require('xmldoc');\nvar fs = require('fs');\n\nvar essenceFile_ = '../data/ucum-essence.xml';\n\n/**\n * The full xml document\n * @type XmlDocument\n */\nvar xmlInput_ = null;\n\nexport class UcumXmlDocument {\n\n\n /**\n * Constructor. This reads the XML document (essenceFile_) into the\n * xmldoc object, which is an object used by the xmldoc class available\n * from GitHub - https://github.com/nfarina/xmldoc. The object provides\n * methods to read the file and access its contents.\n *\n */\n constructor() {\n // read the XML file and create an xmlDocument object from it.\n let data = fs.readFileSync(essenceFile_);\n xmlInput_ = new xmldoc.XmlDocument(data);\n\n // Array of unit codes in the ucum-essence.xml file that indicate a\n // mole based unit. The moleExp_ attribute for these units needs to be\n // set, but there doesn't seem to be an algorithmic way to find these.\n // Creation of unit objects after this file is processed will pick up\n // the moleExp_ value from the base mole unit, but the ones defined in\n // this file will not necessarily do that.\n this.moleCodes_ = ['mol', 'osm', 'kat', 'U' ];\n // Works similarly to the moleCodes_ array, but for units that represents\n // equivalent units. For unit codes in the equivCodes_ array, an equivalentExp_ \n // attribute flag will be set to 1. \n this.equivCodes_ = ['eq'];\n\n // Make this a singleton. See UnitTables constructor for details.\n\n let holdThis = UcumXmlDocument.prototype;\n UcumXmlDocument = function () {\n throw (new Error('UcumXmlDocument is a Singleton. ' +\n 'Use UcumXmlDocument.getInstance() instead.'));\n };\n if (exports)\n exports.UcumXmlDocument = UcumXmlDocument;\n UcumXmlDocument.prototype = holdThis;\n\n let self = this ;\n UcumXmlDocument.getInstance = function(){return self} ;\n }\n\n\n /**\n * This method controls parsing of the XML into objects used by this\n * program. It uses separate methods to parse the prefixes, the\n * base units, and the units.\n *\n * @returns nothing\n */\n parseXml() {\n\n this.parsePrefixes(xmlInput_.childrenNamed(\"prefix\"));\n this.parseBaseUnits(xmlInput_.childrenNamed(\"base-unit\")) ;\n this.parseUnitStrings(xmlInput_.childrenNamed(\"unit\")) ;\n\n // Create or replace the json file of the prefix and unit definitions\n this.writeJsonFile();\n this.writeVersionText();\n\n }\n\n\n /**\n * Creates prefix objects from the xml prefix nodes passed in and gets\n * them added to the prefix tables.\n *\n * @params prefixes the array of prefix nodes from the xml file, in the\n * order in which the nodes are defined in that file.\n *\n * @returns nothing\n */\n parsePrefixes(prefixes) {\n\n\n let plen = prefixes.length ;\n\n for (let p = 0; p < plen; p++) {\n let curPfx = prefixes[p];\n let attrs = {} ;\n\n attrs[\"code_\"] = curPfx.attr.Code;\n attrs[\"ciCode_\"] = curPfx.attr.CODE;\n attrs[\"name_\"] = curPfx.childNamed('name').val;\n attrs[\"printSymbol_\"] = curPfx.childNamed('printSymbol').val;\n\n // Set the prefix value. If there is a <sup> element in the\n // value node, then this is a base 10 based prefix (10 to the x power).\n // Set the value to 10 taken to the indicated power.\n // Otherwise this is not 10 based and the value contains the\n // actual value for the prefix.\n let pValNode = curPfx.childNamed('value') ;\n attrs[\"value_\"] = null;\n attrs[\"exp_\"] = pValNode.childNamed('sup');\n if (attrs[\"exp_\"] != null) {\n attrs[\"exp_\"] = attrs[\"exp_\"].val;\n // Use parseFloat('1eSOMETHING') instead of Math.pow() to avoid\n // small number changes like 1.0000000000000001e-21. See LF-2830.\n // attrs[\"value_\"] = Math.pow(10, attrs[\"exp_\"]);\n attrs[\"value_\"] = parseFloat(`1e${attrs[\"exp_\"]}`);\n }\n else {\n attrs[\"value_\"] = pValNode.val;\n attrs[\"exp_\"] = null;\n }\n\n // Make sure the prefix has not already been created. If it hasn't,\n // create the prefix object and then add it to the prefix tables.\n let ptab = PrefixTables.getInstance();\n if (ptab.isDefined(attrs[\"code_\"])) {\n throw(new Error('Prefix constructor called for prefix already ' +\n `defined; code = ${attrs[\"code_\"]}`));\n }\n else {\n let newPref = new Prefix(attrs);\n ptab.add(newPref);\n }\n }\n } // end parsePrefixes\n\n\n /**\n * Creates base unit objects from the xml nodes passed in and adds\n * them to the unit tables.\n *\n * @params unitNodes the array of base unit nodes from the xml file, in the\n * order in which the nodes are defined in that file. (Order is important\n * for all units).\n *\n * @returns nothing\n */\n parseBaseUnits(unitNodes) {\n let blen = unitNodes.length ;\n let utab = UnitTables.getInstance() ;\n for (let b = 0; b < blen; b++) {\n let curBUnit = unitNodes[b];\n let attrs = {} ;\n attrs['isBase_'] = true ;\n attrs['name_'] = curBUnit.childNamed('name').val ;\n attrs['csCode_'] = curBUnit.attr.Code ;\n attrs['ciCode_'] = curBUnit.attr.CODE ;\n attrs['property_'] = curBUnit.childNamed('property').val;\n attrs['variable_'] = curBUnit.attr.dim ;\n attrs['printSymbol_'] = curBUnit.childNamed('printSymbol').val;\n attrs['dim_'] = b ;\n attrs['source_'] = 'UCUM';\n let newUnit = new Unit(attrs);\n utab.addUnit(newUnit) ;\n }\n } // end parseBaseUnits\n\n\n /**\n * Creates non-base unit objects from the xml nodes passed in and adds\n * them to the unit tables.\n *\n * @params unitStrings the array of non-base unit nodes from the xml file, in the\n * order in which the nodes are defined in that file. (Order is important\n * for all units).\n *\n * @returns nothing\n */\n parseUnitStrings(unitStrings) {\n\n let utab = UnitTables.getInstance() ;\n let uStrParser = UnitString.getInstance();\n let stopNow = false ;\n let alen = unitStrings.length ;\n for (let a = 0; a < alen && !stopNow; a++) {\n let haveUnit = true;\n let curUA = unitStrings[a];\n let attrs = {};\n attrs['isBase_'] = false;\n attrs['source_'] = 'UCUM';\n attrs['name_'] = curUA.childNamed('name').val;\n attrs['csCode_'] = curUA.attr.Code;\n if (curUA.attr.CODE)\n attrs['ciCode_'] = curUA.attr.CODE;\n else\n attrs['ciCode_'] = curUA.attr.Code.toUpperCase();\n attrs['property_'] = curUA.childNamed('property').val;\n if (curUA.childNamed('printSymbol')) {\n let sym = curUA.childNamed('printSymbol') ;\n let symVal = sym.val;\n symVal = symVal.replace(/\\n/g, \"\");\n symVal = symVal.trim();\n let symI = sym.childNamed('i');\n if (symI)\n //symVal = '<i>' + symI.val + '</>';\n symVal = symI.toString({compressed:true});\n let sub = sym.childNamed('sub');\n let sup = sym.childNamed('sup');\n if (sub)\n symVal += sub.toString({compressed:true});\n if (sup)\n symVal += sup.toString({compressed:true});\n\n attrs['printSymbol_'] = symVal;\n }\n if (curUA.attr.isMetric === \"yes\")\n attrs['isMetric_'] = true ;\n else\n attrs['isMetric_'] = false ;\n if (curUA.attr.isArbitrary)\n attrs['isArbitrary_'] = true ;\n else\n attrs['isArbitrary_'] = false ;\n if (curUA.attr.class) {\n attrs['class_'] = curUA.attr.class;\n }\n let valNode = curUA.childNamed('value');\n // Note: This currently works as a boolean flag,\n // but it should be used to represent the dimensionality\n // of the unit as an integer instead.\n if (this.moleCodes_.indexOf(curUA.attr.Code) !== -1)\n attrs['moleExp_'] = 1;\n else\n attrs['moleExp_'] = 0;\n // Adds a flag similar to how moleExp_ works, but for units \n // that are equivalent. Note that ideally this should also\n // take values other than 1 or 0, but for now it is a boolean \n // flag.\n if (this.equivCodes_.indexOf(curUA.attr.Code) !== -1) {\n attrs['equivalentExp_'] = 1;\n }\n\n\n // Process special units\n if (curUA.attr.isSpecial) {\n attrs['isSpecial_'] = curUA.attr.isSpecial === \"yes\";\n let funcNode = valNode.childNamed('function');\n attrs['cnv_'] = funcNode.attr.name;\n attrs['csUnitString_'] = funcNode.attr.Unit;\n if (attrs['csUnitString_'] === '1') {\n attrs['baseFactor_'] = 1 ;\n }\n else if (attrs['csCode_'] === '[pH]') {\n attrs['baseFactor_'] = parseFloat(funcNode.attr.value) ;\n }\n else {\n let slashPos = attrs['csUnitString_'].indexOf('/');\n let ar = [];\n\n // unit string = K/9 or K/4 or m2/s4/Hz\n if (slashPos >= 0) {\n ar = attrs['csUnitString_'].split('/');\n }\n // unit string = K/9 or K/4\n if ((slashPos >= 0) && (ar.length === 2)) {\n attrs['csUnitString_'] = ar[0];\n attrs['baseFactor_'] = parseFloat(funcNode.attr.value/ar[1]);\n }\n // unit string = 10*-5.Pa\n else if (attrs['csCode_'] === 'B[SPL]') {\n attrs['baseFactor_'] = Math.pow(10, -5) * 2 ;\n attrs['csUnitString_'] = \"Pa\" ;\n }\n // unit string = m1/s4/Hz, K, deg, V, mV, uV, nV, W, kW\n else {\n attrs['baseFactor_'] = parseFloat(funcNode.attr.value);\n }\n } // end if the unit string is not 1\n } // end if the unit is special\n\n else {\n // what I'm calling the unit string is the string that defines the\n // unit based on other units, e.g., rad2 (radian squared) to define\n // a steradian unit. It's not necessarily a proper base unit, although\n // it ultimately builds on base units.\n attrs['csUnitString_'] = valNode.attr.Unit;\n attrs['ciUnitString_'] = valNode.attr.UNIT;\n\n // what I'm calling the factor here (string and number versions)\n // is the magnitude used in conjunction with the unit string to define\n // the new unit, e.g., 3 for a yard that is based in the definition\n // of feet.\n\n attrs['baseFactorStr_'] = valNode.attr.value;\n if (attrs['csCode_'] === '[pi]')\n attrs['baseFactor_'] = parseFloat(attrs['baseFactorStr_']);\n else if (valNode.childNamed('sup')) {\n attrs['baseFactor_'] = parseFloat(valNode.attr.value) ;\n }\n else {\n attrs['baseFactor_'] = parseFloat(valNode.val);\n }\n } // end if this is not a special unit\n\n // Arbitrary units are defined in the UCUM spec as \"not of any\n // specific dimension and are not commensurable with any other\n // unit\" (3.2.24). All arbitrary units in the units definition\n // XML file currently have a unit string of 1 and a base factor of 1\n // except the \"international unit\" with a code of [IU]. Its\n // unit string is the \"international unit\" with a code of [iU],\n // which is also an arbitrary unit - with a unit string of 1.\n // So I am assuming [IU] is just another code for the same unit.\n if (attrs['isArbitrary_'] === true) {\n attrs['magnitude_'] = 1;\n attrs['dim_'] = null;\n }\n\n // units with class = \"dimless\" don't have dimension arrays.\n // They're things like the number pi or the number 10 or percent.\n // Haven't figured out how to handle them yet.\n else if (attrs['class_'] === 'dimless' ||\n attrs['csCode_'] === 'mol') {\n attrs['dim_'] = null ;\n // figure the magnitude based on the unit string\n // if it's 1, the magnitude is the value specified for\n // the base factor, e.g., 3.141592653589793238462 ... for pi\n if (attrs['csUnitString_'] === '1') {\n attrs['magnitude_'] = attrs['baseFactor_'];\n }\n // else if the unit string starts with 10*, the magnitude is\n // 10 to the power specified following 10* e.g., unit = 10*-2\n // for the \"%\" unit. Except for the mole, which is that\n // multiplied by the base factor, which in this case (only,\n // I think) is not 1.\n else if (attrs['csUnitString_'].substr(0,3) == \"10*\") {\n let exp = parseInt(attrs['csUnitString_'].substr(3));\n attrs['magnitude_'] = Math.pow(10, exp) ;\n if (attrs['baseFactor_'] !== 1) {\n attrs['magnitude_'] *= attrs['baseFactor_'];\n }\n }\n // else I don't know what it is.\n else {\n attrs['defError_'] = true ;\n console.log('unexpected dimless unit definition, unit code ' +\n 'is ' + attrs['csCode_']) ;\n }\n } // end if this is a unit with class = dimless\n\n // Handle carat of gold alloys - which doesn't get a dimension\n //\n else if (attrs['csCode_'] === \"[car_Au]\") {\n attrs['magnitude_'] = 1/24 ;\n attrs['dim_'] = null ;\n }\n else {\n\n // Make sure there's a unit string to base the new unit on. There\n // should be, but I'm just checking here to make sure. And omit\n // ones with a unit string of 1. That won't do us any good.\n if (attrs['csUnitString_'] && attrs['csUnitString_'] !== '1' &&\n attrs['csUnitString_'] !== 1) {\n\n haveUnit = false;\n // Handle some special cases\n // 1. the Oersted unit, whose string is /[pi].A/m and whose\n // value is 250. Set the baseFactor to 250/[pi] and\n // the unit string to A/m\n if (attrs['csCode_'] === 'Oe') {\n attrs['baseFactor_'] = 250 / Math.PI;\n attrs['csUnitString_'] = \"A/m\"\n }\n // 2. Strings that start with '/'. Set the function to\n // the inverse function and trim the '/' off the front\n // of the string.\n else if (attrs['csUnitString_'][0] === '/') {\n attrs['cnv_'] = 'inv';\n attrs['csUnitString_'] = attrs['csUnitString_'].substr(1);\n }\n // 3. the Svedberg unit, whose string is 10*-13.s. Set the\n // base factor to 10*-13 and the unit string to s.\n else if (attrs['csCode_'] === '[S]') {\n attrs['baseFactor_'] = Math.pow(10, -13);\n attrs['csUnitString_'] = 's';\n }\n // 4. permeability of vaccuum - code [mu_0], unit given is\n // 4.[pi].10*-7.N/A2\n else if (attrs['csCode_'] === '[mu_0]') {\n attrs['baseFactor_'] = 4 * Math.PI * Math.pow(10, -7);\n attrs['csUnitString_'] = 'N/A2';\n }\n // The unit string parser will use the unit(s) named in the\n // string to create a new unit with the appropriate dimension\n // object and magnitude before it's multiplied by the one\n // specified in the input node.\n try {\n let retObj = uStrParser.parseString(attrs['csUnitString_'],\n 'validate', false);\n let ret = retObj[0];\n let retString = retObj[1];\n let retMsg = retObj[2];\n\n // Get the dimension object and magnitude (and adjust by\n // specified magnitude factor) from the unit created and\n // assign them to the attributes we'll use to create the\n // unit for this listing.\n if (ret) {\n attrs['dim_'] = ret.getProperty('dim_');\n let newMag = ret.getProperty('magnitude_');\n newMag *= attrs['baseFactor_'];\n attrs['magnitude_'] = newMag;\n haveUnit = true ;\n }\n // if there's no unit, report an error\n else {\n attrs['defError_'] = true;\n console.log(`unit definition error; code = ${attrs['csCode_']}; `+\n `msg = ${retMsg}`);\n attrs['dim_'] = null;\n attrs['magnitude_'] = null;\n }\n }\n catch(err) {\n console.log('error thrown from unit parsing code for unit name ' +\n attrs['name_'] + '\\n' + err.message);\n stopNow = true;\n }\n } // end if there is a unit string to parse\n } // end if this is not a dimless unit\n\n if (haveUnit) {\n // Now create the unit we want based on the attributes we've\n // accumulated from the xml input and from figuring the dimension\n // and magnitude. Add it to the unit tables\n let newUnit = new Unit(attrs);\n utab.addUnit(newUnit);\n\n // for now, create a list of the units created and save it to a file\n // for debugging. This is a temporary file.\n let uList = utab.printUnits();\n fs.writeFileSync('UnitsList.txt', uList,\n {encoding: 'utf8', mode: 0o666, flag: 'w'});\n } // end if have a parsed unit\n } // end for a => - to alen\n\n } // end parseUnitStrings\n\n\n /**\n * This writes out the ucumDefs data file, which contains all prefixes and\n * units (base units and others) read and parsed from the XML file.\n *\n * This creates or replace the file \"ucumDefs.json\" in the data directory.\n */\n writeJsonFile() {\n\n let licenseText = \"The following data (prefixes and units) was generated \" +\n \"by the UCUM LHC code from the UCUM data and selected \" +\n \"LOINC combinations of UCUM units. The license for \" +\n \"the UCUM LHC code (demo and library code as well as \" +\n \"the combined units) is located at \" +\n \"https://github.com/lhncbc/ucum-lhc/blob/LICENSE.md.\" ;\n let pfxTabs = PrefixTables.getInstance() ;\n let pfxArray = pfxTabs.allPrefixesByCode();\n let uTabs = UnitTables.getInstance();\n let uArray = uTabs.allUnitsByDef();\n\n let defsHash = { 'license' : licenseText,\n 'prefixes' : packArray(pfxArray),\n 'units' : packArray(uArray)};\n let dt = new Date();\n jsonfile.writeFileSync('../data/ucumDefs.json',\n defsHash,\n {spaces: 2, encoding: 'utf8', mode: 0o644, flag: 'w'});\n jsonfile.writeFileSync('../data/ucumDefs.min.json',\n defsHash,\n {encoding: 'utf8', mode: 0o644, flag: 'w'});\n } // end writeJsonFile\n\n /**\n * This writes out the ucumDefs data file, which contains all prefixes and\n * units (base units and others) read and parsed from the XML file.\n *\n * This creates the file in the data directory and appends the\n * current Date object value to \"ucumDefs\" so that this does not run\n * into problems with a previously existing file.\n */\n writeVersionText() {\n\n let rootNode = xmlInput_;\n let versionNum = rootNode.attr.version;\n let revNum = rootNode.attr.revision;\n revNum = revNum.replace('$Revision:', '');\n revNum = revNum.replace('$', '');\n revNum = revNum.trim();\n let rootString = rootNode.toString({compressed:true});\n let dateIdx = rootString.indexOf('$Date:');\n rootString = rootString.substr(dateIdx + 6);\n let nextDolIdx = rootString.indexOf('$');\n let revDate = rootString.substr(0, nextDolIdx ).replace('$','');\n revDate = revDate.trim();\n let versionText = `version ${versionNum}, revision ${revNum}, ` +\n `dated ${revDate}`;\n\n fs.writeFileSync('../data/ucumEssenceVersion.txt',\n versionText, {encoding: 'utf8', mode: 0o644, flag: 'w'});\n } // end writeVersionText\n\n} // end UcumXmlDocument\n\n\n/**\n * This function exists ONLY until the original UcumXmlDocument 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 UcumXmlDocument object. This is based on the UnitTables singleton\n * implementation; see more detail in the UnitTables constructor description.\n *\n * @return the singleton UcumXmlDocument object.\n */\nUcumXmlDocument.getInstance = function(){\n return new UcumXmlDocument();\n}\n\n// Perform the first request for the document object, to get the\n// getInstance method set.\nUcumXmlDocument.getInstance();\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIA,MAAM,GAAGC,OAAO,CAAC,aAAa,CAAC,CAACD,MAAM;AAC1C,IAAIE,YAAY,GAAGD,OAAO,CAAC,mBAAmB,CAAC,CAACC,YAAY;AAC5D,IAAIC,IAAI,GAAGF,OAAO,CAAC,WAAW,CAAC,CAACE,IAAI;AACpC,IAAIC,UAAU,GAAGH,OAAO,CAAC,iBAAiB,CAAC,CAACG,UAAU;AACtD,IAAIC,UAAU,GAAGJ,OAAO,CAAC,iBAAiB,CAAC,CAACI,UAAU;AACtD,IAAIC,SAAS,GAAGL,OAAO,CAAC,oBAAoB,CAAC,CAACK,SA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