@lhncbc/ucum-lhc 4.2.0 → 5.0.2

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.
Files changed (36) hide show
  1. package/README.md +50 -12
  2. package/browser-dist/ucum-lhc.js +841 -1325
  3. package/data/ucumDefs.min.json +1 -1
  4. package/package.json +1 -1
  5. package/source/ucumLhcUtils.js +100 -66
  6. package/source/ucumXmlDocument.js +5 -2
  7. package/source/unit.js +2 -1
  8. package/source/unitString.js +159 -140
  9. package/source-cjs/config.js +1 -12
  10. package/source-cjs/config.js.map +1 -1
  11. package/source-cjs/dimension.js +20 -63
  12. package/source-cjs/dimension.js.map +1 -1
  13. package/source-cjs/jsonArrayPack.js +7 -25
  14. package/source-cjs/jsonArrayPack.js.map +1 -1
  15. package/source-cjs/prefix.js +12 -26
  16. package/source-cjs/prefix.js.map +1 -1
  17. package/source-cjs/prefixTables.js +10 -24
  18. package/source-cjs/prefixTables.js.map +1 -1
  19. package/source-cjs/ucumFunctions.js +35 -32
  20. package/source-cjs/ucumFunctions.js.map +1 -1
  21. package/source-cjs/ucumInternalUtils.js +5 -13
  22. package/source-cjs/ucumInternalUtils.js.map +1 -1
  23. package/source-cjs/ucumJsonDefs.js +1 -16
  24. package/source-cjs/ucumJsonDefs.js.map +1 -1
  25. package/source-cjs/ucumLhcUtils.js +117 -138
  26. package/source-cjs/ucumLhcUtils.js.map +1 -1
  27. package/source-cjs/ucumPkg.js +1 -6
  28. package/source-cjs/ucumPkg.js.map +1 -1
  29. package/source-cjs/ucumXmlDocument.js +162 -184
  30. package/source-cjs/ucumXmlDocument.js.map +1 -1
  31. package/source-cjs/unit.js +97 -181
  32. package/source-cjs/unit.js.map +1 -1
  33. package/source-cjs/unitString.js +537 -618
  34. package/source-cjs/unitString.js.map +1 -1
  35. package/source-cjs/unitTables.js +33 -139
  36. package/source-cjs/unitTables.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../source/jsonArrayPack.js"],"names":["pushFn","Array","prototype","push","isObject","value","Object","toString","call","createConfig","refObj","keys","reduce","config","key","apply","map","keyTail","concat","prepareConfig","isArray","packItem","item","join","Error","keyArr","place","forEach","undefined","unpackItem","result","i","length","packArray","arr","_config","data","bind","unpackArray","obj"],"mappings":";;;;;;;;AAAA;;;AAGA,MAAMA,MAAM,GAAGC,KAAK,CAACC,SAAN,CAAgBC,IAA/B;;AAEA,SAASC,QAAT,CAAkBC,KAAlB,EAAyB;AACvB,SAAOC,MAAM,CAACJ,SAAP,CAAiBK,QAAjB,CAA0BC,IAA1B,CAA+BH,KAA/B,MAA0C,iBAAjD;AACD;AAED;;;;;;;AAKA,SAASI,YAAT,CAAsBC,MAAtB,EAA8B;AAC5B,SAAOJ,MAAM,CAACK,IAAP,CAAYD,MAAZ,EAAoBE,MAApB,CAA2B,CAACC,MAAD,EAASC,GAAT,KAAiB;AACjD,QAAIV,QAAQ,CAACM,MAAM,CAACI,GAAD,CAAP,CAAZ,EAA2B;AACzBd,MAAAA,MAAM,CAACe,KAAP,CAAaF,MAAb,EAAqBJ,YAAY,CAACC,MAAM,CAACI,GAAD,CAAP,CAAZ,CAA0BE,GAA1B,CAA8BC,OAAO,IAAI,CAACH,GAAD,EAAM,GAAG,GAAGI,MAAH,CAAUD,OAAV,CAAT,CAAzC,CAArB;AACD,KAFD,MAEO;AACLJ,MAAAA,MAAM,CAACV,IAAP,CAAYW,GAAZ;AACD;;AACD,WAAOD,MAAP;AACD,GAPM,EAOJ,EAPI,CAAP;AAQD;AAED;;;;;;;AAKA,SAASM,aAAT,CAAuBN,MAAvB,EAA+B;AAC7B,SAAOA,MAAM,CAACG,GAAP,CAAWF,GAAG,IAAIb,KAAK,CAACmB,OAAN,CAAcN,GAAd,IAAqBA,GAArB,GAA2B,CAACA,GAAD,CAA7C,CAAP;AACD;AAED;;;;;;;;AAMA,SAASO,QAAT,CAAkBR,MAAlB,EAA0BS,IAA1B,EAAgC;AAC9B,MAAIT,MAAM,CAACU,I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yB,GAAG,CAAC,CAAD,CAAJ,CAA3B;AAAA,UACEC,OAAO,GAAGhB,aAAa,CAACN,MAAD,CADzB;;AAGA,QAAIA,MAAM,CAACmB,MAAX,EAAmB;AACjB,aAAO;AACLnB,QAAAA,MAAM,EAAEA,MADH;AAELuB,QAAAA,IAAI,EAAEF,GAAG,CAAClB,GAAJ,CAAQK,QAAQ,CAACgB,IAAT,CAAc,IAAd,EAAoBF,OAApB,CAAR;AAFD,OAAP;AAID;AACF;;AAED,SAAO;AACLtB,IAAAA,MAAM,EAAE,EADH;AAELuB,IAAAA,IAAI,EAAEF;AAFD,GAAP;AAID;AAED;;;;;;;AAKO,SAASI,WAAT,CAAqBC,GAArB,EAA0B;AAC/B,QAAM1B,MAAM,GAAG0B,GAAG,IAAIA,GAAG,CAAC1B,MAA1B;;AAEA,MAAIA,MAAJ,EAAY;AACV,QAAIA,MAAM,CAACmB,MAAP,IAAiBO,GAAG,CAACH,IAAzB,EAA+B;AAC7B,YAAMD,OAAO,GAAGhB,aAAa,CAACN,MAAD,CAA7B;;AAEA,aAAO0B,GAAG,CAACH,IAAJ,CAASpB,GAAT,CAAaa,UAAU,CAACQ,IAAX,CAAgB,IAAhB,EAAsBF,OAAtB,CAAb,CAAP;AACD,KAJD,MAIO;AACL,aAAOI,GAAG,CAACH,IAAX;AACD;AACF;;AAED,SAAOG,GAAP;AACD","sourcesContent":["/**\n * This file provides functions to reduce the size of an array of objects of the same structure in JSON.\n */\nconst pushFn = Array.prototype.push;\n\nfunction isObject(value) {\n return Object.prototype.toString.call(value) === '[object Object]';\n}\n\n/**\n * Makes human readable config used to pack/unpack array of objects of the same structure to store with packed data.\n * @param {Object} refObj - reference item of array of objects of the same structure\n * @returns {Array}\n */\nfunction createConfig(refObj) {\n return Object.keys(refObj).reduce((config, key) => {\n if (isObject(refObj[key])) {\n pushFn.apply(config, createConfig(refObj[key]).map(keyTail => [key, ...[].concat(keyTail)]));\n } else {\n config.push(key);\n }\n return config;\n }, [])\n}\n\n/**\n * Prepares config created with createConfig function to use in packItem/unpackItem functions.\n * @param {Array} config\n * @returns {Array}\n */\nfunction prepareConfig(config) {\n return config.map(key => Array.isArray(key) ? key : [key]);\n}\n\n/**\n * Converts an object to an array of values in the order of keys from configuration array.\n * @param {Array} config - configuration array\n * @param {Object} item - input object\n * @returns {Array}\n */\nfunction packItem(config, item) {\n if (config.join() !== prepareConfig(createConfig(item)).join()) {\n throw new Error('Object of unusual structure')\n }\n\n return config.map(keyArr => {\n let place = item;\n keyArr.forEach(key => {\n place = place[key];\n if (place === undefined) {\n throw new Error('Object of unusual structure')\n }\n });\n return place;\n });\n}\n\n/**\n * Performs the reverse of packItem function.\n * @param {Array} config - configuration array\n * @param {Array} item - input object\n * @returns {Object}\n */\nfunction unpackItem(config, item) {\n let result = {};\n\n config.forEach((keyArr, i) => {\n let place = result;\n for (let i = 0; i < keyArr.length - 1; i++) {\n place = place[keyArr[i]] = place[keyArr[i]] || {};\n }\n place[keyArr[keyArr.length - 1]] = item[i];\n });\n\n return result;\n}\n\n/**\n * Reduces size of an array of objects of the same structure before serialize it to JSON\n * @param {Array} arr\n * @returns {Object}\n */\nexport function packArray(arr) {\n if (arr && arr.length) {\n const config = createConfig(arr[0]),\n _config = prepareConfig(config);\n\n if (config.length) {\n return {\n config: config,\n data: arr.map(packItem.bind(null, _config))\n };\n }\n }\n\n return {\n config: [],\n data: arr\n };\n}\n\n/**\n * Restores an array of objects of the same structure after deserializing this object from JSON\n * @param {Object} obj\n * @returns {Array}\n */\nexport function unpackArray(obj) {\n const config = obj && obj.config;\n\n if (config) {\n if (config.length && obj.data) {\n const _config = prepareConfig(config);\n\n return obj.data.map(unpackItem.bind(null, _config));\n } else {\n return obj.data;\n }\n }\n\n return obj;\n}"],"file":"jsonArrayPack.js"}
1
+ {"version":3,"file":"jsonArrayPack.js","names":["pushFn","Array","prototype","push","isObject","value","Object","toString","call","createConfig","refObj","keys","reduce","config","key","apply","map","keyTail","concat","prepareConfig","isArray","packItem","item","join","Error","keyArr","place","forEach","undefined","unpackItem","result","i","length","packArray","arr","_config","data","bind","unpackArray","obj"],"sources":["../source/jsonArrayPack.js"],"sourcesContent":["/**\n * This file provides functions to reduce the size of an array of objects of the same structure in JSON.\n */\nconst pushFn = Array.prototype.push;\n\nfunction isObject(value) {\n return Object.prototype.toString.call(value) === '[object Object]';\n}\n\n/**\n * Makes human readable config used to pack/unpack array of objects of the same structure to store with packed data.\n * @param {Object} refObj - reference item of array of objects of the same structure\n * @returns {Array}\n */\nfunction createConfig(refObj) {\n return Object.keys(refObj).reduce((config, key) => {\n if (isObject(refObj[key])) {\n pushFn.apply(config, createConfig(refObj[key]).map(keyTail => [key, ...[].concat(keyTail)]));\n } else {\n config.push(key);\n }\n return config;\n }, [])\n}\n\n/**\n * Prepares config created with createConfig function to use in packItem/unpackItem functions.\n * @param {Array} config\n * @returns {Array}\n */\nfunction prepareConfig(config) {\n return config.map(key => Array.isArray(key) ? key : [key]);\n}\n\n/**\n * Converts an object to an array of values in the order of keys from configuration array.\n * @param {Array} config - configuration array\n * @param {Object} item - input object\n * @returns {Array}\n */\nfunction packItem(config, item) {\n if (config.join() !== prepareConfig(createConfig(item)).join()) {\n throw new Error('Object of unusual structure')\n }\n\n return config.map(keyArr => {\n let place = item;\n keyArr.forEach(key => {\n place = place[key];\n if (place === undefined) {\n throw new Error('Object of unusual structure')\n }\n });\n return place;\n });\n}\n\n/**\n * Performs the reverse of packItem function.\n * @param {Array} config - configuration array\n * @param {Array} item - input object\n * @returns {Object}\n */\nfunction unpackItem(config, item) {\n let result = {};\n\n config.forEach((keyArr, i) => {\n let place = result;\n for (let i = 0; i < keyArr.length - 1; i++) {\n place = place[keyArr[i]] = place[keyArr[i]] || {};\n }\n place[keyArr[keyArr.length - 1]] = item[i];\n });\n\n return result;\n}\n\n/**\n * Reduces size of an array of objects of the same structure before serialize it to JSON\n * @param {Array} arr\n * @returns {Object}\n */\nexport function packArray(arr) {\n if (arr && arr.length) {\n const config = createConfig(arr[0]),\n _config = prepareConfig(config);\n\n if (config.length) {\n return {\n config: config,\n data: arr.map(packItem.bind(null, _config))\n };\n }\n }\n\n return {\n config: [],\n data: arr\n };\n}\n\n/**\n * Restores an array of objects of the same structure after deserializing this object from JSON\n * @param {Object} obj\n * @returns {Array}\n */\nexport function unpackArray(obj) {\n const config = obj && obj.config;\n\n if (config) {\n if (config.length && obj.data) {\n const _config = prepareConfig(config);\n\n return obj.data.map(unpackItem.bind(null, _config));\n } else {\n return obj.data;\n }\n }\n\n return obj;\n}"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA,MAAMA,MAAM,GAAGC,KAAK,CAACC,SAAS,CAACC,IAAI;AAEnC,SAASC,QAAQA,CAACC,KAAK,EAAE;EACvB,OAAOC,MAAM,CAACJ,SAAS,CAACK,QAAQ,CAACC,IAAI,CAACH,KAAK,CAAC,KAAK,iBAAiB;AACpE;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASI,YAAYA,CAACC,MAAM,EAAE;EAC5B,OAAOJ,MAAM,CAACK,IAAI,CAACD,MAAM,CAAC,CAACE,MAAM,CAAC,CAACC,MAAM,EAAEC,GAAG,KAAK;IACjD,IAAIV,QAAQ,CAACM,MAAM,CAACI,GAAG,CAAC,CAAC,EAAE;MACzBd,MAAM,CAACe,KAAK,CAACF,MAAM,EAAEJ,YAAY,CAACC,MAAM,CAACI,GAAG,CAAC,CAAC,CAACE,GAAG,CAACC,OAAO,IAAI,CAACH,GAAG,EAAE,GAAG,EAAE,CAACI,MAAM,CAACD,OAAO,CAAC,CAAC,CAAC,CAAC;IAC9F,CAAC,MAAM;MACLJ,MAAM,CAACV,IAAI,CAACW,GAAG,CAAC;IAClB;IACA,OAAOD,MAAM;EACf,CAAC,EAAE,EAAE,CAAC;AACR;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASM,aAAaA,CAACN,MAAM,EAAE;EAC7B,OAAOA,MAAM,CAACG,GAAG,CAACF,GAAG,IAAIb,KAAK,CAACmB,OAAO,CAACN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EAEF,OAAOD,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASG,SAASA,CAACC,GAAG,EAAE;EAC7B,IAAIA,GAAG,IAAIA,GAAG,CAACF,MAAM,EAAE;IACrB,MAAMnB,MAAM,GAAGJ,YAAY,CAACyB,GAAG,CAAC,CAAC,CAAC,CAAC;MACjCC,OAAO,GAAGhB,aAAa,CAACN,MAAM,CAAC;IAEjC,IAAIA,MAAM,CAACmB,MAAM,EAAE;MACjB,OAAO;QACLnB,MAAM,EAAEA,MAAM;QACduB,IAAI,EAAEF,GAAG,CAAClB,GAAG,CAACK,QAAQ,CAACgB,IAAI,CAAC,IAAI,EAAEF,OAAO,CAAC;MAC5C,CAAC;IACH;EACF;EAEA,OAAO;IACLtB,MAAM,EAAE,EAAE;IACVuB,IAAI,EAAEF;EACR,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASI,WAAWA,CAACC,GAAG,EAAE;EAC/B,MAAM1B,MAAM,GAAG0B,GAAG,IAAIA,GAAG,CAAC1B,MAAM;EAEhC,IAAIA,MAAM,EAAE;IACV,IAAIA,MAAM,CAACmB,MAAM,IAAIO,GAAG,CAACH,IAAI,EAAE;MAC7B,MAAMD,OAAO,GAAGhB,aAAa,CAACN,MAAM,CAAC;MAErC,OAAO0B,GAAG,CAACH,IAAI,CAACpB,GAAG,CAACa,UAAU,CAACQ,IAAI,CAAC,IAAI,EAAEF,OAAO,CAAC,CAAC;IACrD,CAAC,MAAM;MACL,OAAOI,GAAG,CAACH,IAAI;IACjB;EACF;EAEA,OAAOG,GAAG;AACZ"}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Prefix = void 0;
7
-
8
7
  /**
9
8
  * Prefix objects are defined in this file.
10
9
  */
@@ -17,7 +16,6 @@ exports.Prefix = void 0;
17
16
  *
18
17
  */
19
18
  var Ucum = require('./config.js');
20
-
21
19
  class Prefix {
22
20
  /**
23
21
  * Creates a single prefix object.
@@ -43,6 +41,7 @@ class Prefix {
43
41
  if (attrs['code_'] === undefined || attrs['code_'] === null || attrs['name_'] === undefined || attrs['name_'] === null || attrs['value_'] === undefined || attrs['value_'] === null || attrs['exp_'] === undefined) {
44
42
  throw new Error('Prefix constructor called missing one or more parameters. ' + 'Prefix codes (cs or ci), name, value and exponent must all be specified ' + 'and all but the exponent must not be null.');
45
43
  }
44
+
46
45
  /**
47
46
  * The prefix code, e.g., k for kilo. This should be the case-sensitive
48
47
  * code. Since there's no way to check to see if it's the case-sensitive
@@ -51,34 +50,32 @@ class Prefix {
51
50
  * codes are also all uppercase), we'll just have to believe that the
52
51
  * right one was passed in.
53
52
  */
54
-
55
-
56
53
  this.code_ = attrs['code_'];
54
+
57
55
  /**
58
56
  * The case-insensitive code, e.g., K for kilo
59
57
  */
60
-
61
58
  this.ciCode_ = attrs['ciCode_'];
59
+
62
60
  /**
63
61
  * The prefix name, e.g., kilo
64
62
  */
65
-
66
63
  this.name_ = attrs['name_'];
64
+
67
65
  /**
68
66
  * The printSymbol for the prefix, e.g., k for kilo
69
67
  */
70
-
71
68
  this.printSymbol_ = attrs['printSymbol_'];
69
+
72
70
  /**
73
71
  * The value to use in multiplying the magnitude of a unit
74
72
  */
75
-
76
73
  if (typeof attrs['value_'] === 'string') this.value_ = parseFloat(attrs['value_']);else this.value_ = attrs['value_'];
74
+
77
75
  /**
78
76
  * The exponent used to create the value from 10. For prefixes that are
79
77
  * not based on 10, this will be null.
80
78
  */
81
-
82
79
  this.exp_ = attrs['exp_'];
83
80
  } // end constructor
84
81
 
@@ -86,56 +83,50 @@ class Prefix {
86
83
  * Returns the value for the current prefix object
87
84
  * @return the value for the prefix object with the specified code
88
85
  * */
89
-
90
-
91
86
  getValue() {
92
87
  return this.value_;
93
88
  }
89
+
94
90
  /**
95
91
  * Returns the prefix code for the current prefix object
96
92
  * @return the code for the current prefix object
97
93
  */
98
-
99
-
100
94
  getCode() {
101
95
  return this.code_;
102
96
  }
97
+
103
98
  /**
104
99
  * Returns the case-insensitive code for the current prefix object
105
100
  * @return the case_insensitive code for the current prefix object
106
101
  */
107
-
108
-
109
102
  getCiCode() {
110
103
  return this.ciCode_;
111
104
  }
105
+
112
106
  /**
113
107
  * Returns the prefix name for the current prefix object
114
108
  * @return the name for the current prefix object
115
109
  */
116
-
117
-
118
110
  getName() {
119
111
  return this.name_;
120
112
  }
113
+
121
114
  /**
122
115
  * Returns the print symbol for the current prefix object
123
116
  * @return the print symbol for the current prefix object
124
117
  */
125
-
126
-
127
118
  getPrintSymbol() {
128
119
  return this.printSymbol_;
129
120
  }
121
+
130
122
  /**
131
123
  * Returns the exponent for the current prefix object
132
124
  * @return the exponent for the current prefix object
133
125
  */
134
-
135
-
136
126
  getExp() {
137
127
  return this.exp_;
138
128
  }
129
+
139
130
  /**
140
131
  * Provides way to tell if one prefix equals another. The second prefix
141
132
  * must match all attribute values.
@@ -143,14 +134,9 @@ class Prefix {
143
134
  * @param prefix2 prefix object to check for a match
144
135
  * @return true for a match; false if one or more attributes don't match
145
136
  */
146
-
147
-
148
137
  equals(prefix2) {
149
138
  return this.code_ === prefix2.code_ && this.ciCode_ === prefix2.ciCode_ && this.name_ === prefix2.name_ && this.printSymbol_ === prefix2.printSymbol_ && this.value_ === prefix2.value_ && this.exp_ === prefix2.exp_;
150
139
  }
151
-
152
140
  } // end Prefix class
153
-
154
-
155
141
  exports.Prefix = Prefix;
156
142
  //# sourceMappingURL=prefix.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../source/prefix.js"],"names":["Ucum","require","Prefix","constructor","attrs","undefined","Error","code_","ciCode_","name_","printSymbol_","value_","parseFloat","exp_","getValue","getCode","getCiCode","getName","getPrintSymbol","getExp","equals","prefix2"],"mappings":";;;;;;;AAAA;;;;AAIA;;;;;;;AAOA,IAAIA,IAAI,GAAGC,OAAO,CAAC,aAAD,CAAlB;;AAEO,MAAMC,MAAN,CAAa;AAElB;;;;;;;;;;;;;;;;;;;;AAoBAC,E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KAAKR,KAAZ;AACD;AAGD;;;;;;AAIAS,EAAAA,cAAc,GAAG;AACf,WAAO,KAAKR,YAAZ;AACD;AAGD;;;;;;AAIAS,EAAAA,MAAM,GAAG;AACP,WAAO,KAAKN,IAAZ;AACD;AAGD;;;;;;;;;AAOAO,EAAAA,MAAM,CAACC,OAAD,EAAU;AACd,WAAO,KAAKd,KAAL,KAAec,OAAO,CAACd,KAAvB,IACC,KAAKC,OAAL,KAAiBa,OAAO,CAACb,OAD1B,IAEC,KAAKC,KAAL,KAAeY,OAAO,CAACZ,KAFxB,IAGC,KAAKC,YAAL,KAAsBW,OAAO,CAACX,YAH/B,IAIC,KAAKC,MAAL,KAAgBU,OAAO,CAACV,MAJzB,IAKC,KAAKE,IAAL,KAAcQ,OAAO,CAACR,IAL9B;AAMD;;AA/IiB,C,CAgJlB","sourcesContent":["/**\n * Prefix objects are defined in this file.\n */\n\n/**\n * This class implements the prefix object. Prefixes are used as multipliers\n * for units, e.g., km for kilometers\n *\n * @author Lee Mericle, based on java version by Gunther Schadow\n *\n */\nvar Ucum = require('./config.js');\n\nexport class Prefix {\n\n /**\n * Creates a single prefix object.\n *\n * @param attrs a hash of the values to use in creating the prefix object.\n * They should be:\n * code_ - which is the case-sensitive code used for the prefix,\n * e.g., k for kilo\n * ciCode_ - which is the case-insensitive code used for the prefix,\n * e.g., K for kilo\n * name_ - which is the name of the prefix, e.g., kilo\n * printSymbol_ - which is the print symbol for the prefix, e.g., k for kilo\n * value_ - which is teh value to use in multiplying the magnitude of\n * a unit, e.g., for a prefix of c the value will be .01.\n * exp_ - which is the exponent used to get the value. For decimal based\n * prefixes the base is 10 and the exp_ is applied to 10, e.g., for a\n * prefix of c, the exponent will be -2. For prefixes that are not\n * decimal based, this will be null (but must not be undefined).\n *\n * @throws an error if the not all required parameters are provided\n */\n constructor(attrs) {\n\n if (attrs['code_'] === undefined || attrs['code_'] === null ||\n attrs['name_'] === undefined || attrs['name_'] === null ||\n attrs['value_'] === undefined || attrs['value_'] === null ||\n attrs['exp_'] === undefined) {\n throw(new Error('Prefix constructor called missing one or more parameters. ' +\n 'Prefix codes (cs or ci), name, value and exponent must all be specified ' +\n 'and all but the exponent must not be null.'));\n }\n\n /**\n * The prefix code, e.g., k for kilo. This should be the case-sensitive\n * code. Since there's no way to check to see if it's the case-sensitive\n * one as opposed to the case-insensitive one (because although\n * case-insensitive codes all seem to be uppercase, some case-sensitive\n * codes are also all uppercase), we'll just have to believe that the\n * right one was passed in.\n */\n this.code_ = attrs['code_'];\n\n /**\n * The case-insensitive code, e.g., K for kilo\n */\n this.ciCode_ = attrs['ciCode_'];\n\n /**\n * The prefix name, e.g., kilo\n */\n this.name_ = attrs['name_'];\n\n /**\n * The printSymbol for the prefix, e.g., k for kilo\n */\n this.printSymbol_ = attrs['printSymbol_'];\n\n /**\n * The value to use in multiplying the magnitude of a unit\n */\n if (typeof attrs['value_'] === 'string')\n this.value_ = parseFloat(attrs['value_']);\n else\n this.value_ = attrs['value_'] ;\n\n /**\n * The exponent used to create the value from 10. For prefixes that are\n * not based on 10, this will be null.\n */\n this.exp_ = attrs['exp_'] ;\n\n } // end constructor\n\n\n /**\n * Returns the value for the current prefix object\n * @return the value for the prefix object with the specified code\n * */\n getValue() {\n return this.value_;\n }\n\n\n /**\n * Returns the prefix code for the current prefix object\n * @return the code for the current prefix object\n */\n getCode() {\n return this.code_;\n }\n\n\n /**\n * Returns the case-insensitive code for the current prefix object\n * @return the case_insensitive code for the current prefix object\n */\n getCiCode() {\n return this.ciCode_;\n }\n\n\n /**\n * Returns the prefix name for the current prefix object\n * @return the name for the current prefix object\n */\n getName() {\n return this.name_;\n }\n\n\n /**\n * Returns the print symbol for the current prefix object\n * @return the print symbol for the current prefix object\n */\n getPrintSymbol() {\n return this.printSymbol_;\n }\n\n\n /**\n * Returns the exponent for the current prefix object\n * @return the exponent for the current prefix object\n */\n getExp() {\n return this.exp_;\n }\n\n\n /**\n * Provides way to tell if one prefix equals another. The second prefix\n * must match all attribute values.\n *\n * @param prefix2 prefix object to check for a match\n * @return true for a match; false if one or more attributes don't match\n */\n equals(prefix2) {\n return this.code_ === prefix2.code_ &&\n this.ciCode_ === prefix2.ciCode_ &&\n this.name_ === prefix2.name_ &&\n this.printSymbol_ === prefix2.printSymbol_ &&\n this.value_ === prefix2.value_ &&\n this.exp_ === prefix2.exp_ ;\n }\n} // end Prefix class\n"],"file":"prefix.js"}
1
+ {"version":3,"file":"prefix.js","names":["Ucum","require","Prefix","constructor","attrs","undefined","Error","code_","ciCode_","name_","printSymbol_","value_","parseFloat","exp_","getValue","getCode","getCiCode","getName","getPrintSymbol","getExp","equals","prefix2","exports"],"sources":["../source/prefix.js"],"sourcesContent":["/**\n * Prefix objects are defined in this file.\n */\n\n/**\n * This class implements the prefix object. Prefixes are used as multipliers\n * for units, e.g., km for kilometers\n *\n * @author Lee Mericle, based on java version by Gunther Schadow\n *\n */\nvar Ucum = require('./config.js');\n\nexport class Prefix {\n\n /**\n * Creates a single prefix object.\n *\n * @param attrs a hash of the values to use in creating the prefix object.\n * They should be:\n * code_ - which is the case-sensitive code used for the prefix,\n * e.g., k for kilo\n * ciCode_ - which is the case-insensitive code used for the prefix,\n * e.g., K for kilo\n * name_ - which is the name of the prefix, e.g., kilo\n * printSymbol_ - which is the print symbol for the prefix, e.g., k for kilo\n * value_ - which is teh value to use in multiplying the magnitude of\n * a unit, e.g., for a prefix of c the value will be .01.\n * exp_ - which is the exponent used to get the value. For decimal based\n * prefixes the base is 10 and the exp_ is applied to 10, e.g., for a\n * prefix of c, the exponent will be -2. For prefixes that are not\n * decimal based, this will be null (but must not be undefined).\n *\n * @throws an error if the not all required parameters are provided\n */\n constructor(attrs) {\n\n if (attrs['code_'] === undefined || attrs['code_'] === null ||\n attrs['name_'] === undefined || attrs['name_'] === null ||\n attrs['value_'] === undefined || attrs['value_'] === null ||\n attrs['exp_'] === undefined) {\n throw(new Error('Prefix constructor called missing one or more parameters. ' +\n 'Prefix codes (cs or ci), name, value and exponent must all be specified ' +\n 'and all but the exponent must not be null.'));\n }\n\n /**\n * The prefix code, e.g., k for kilo. This should be the case-sensitive\n * code. Since there's no way to check to see if it's the case-sensitive\n * one as opposed to the case-insensitive one (because although\n * case-insensitive codes all seem to be uppercase, some case-sensitive\n * codes are also all uppercase), we'll just have to believe that the\n * right one was passed in.\n */\n this.code_ = attrs['code_'];\n\n /**\n * The case-insensitive code, e.g., K for kilo\n */\n this.ciCode_ = attrs['ciCode_'];\n\n /**\n * The prefix name, e.g., kilo\n */\n this.name_ = attrs['name_'];\n\n /**\n * The printSymbol for the prefix, e.g., k for kilo\n */\n this.printSymbol_ = attrs['printSymbol_'];\n\n /**\n * The value to use in multiplying the magnitude of a unit\n */\n if (typeof attrs['value_'] === 'string')\n this.value_ = parseFloat(attrs['value_']);\n else\n this.value_ = attrs['value_'] ;\n\n /**\n * The exponent used to create the value from 10. For prefixes that are\n * not based on 10, this will be null.\n */\n this.exp_ = attrs['exp_'] ;\n\n } // end constructor\n\n\n /**\n * Returns the value for the current prefix object\n * @return the value for the prefix object with the specified code\n * */\n getValue() {\n return this.value_;\n }\n\n\n /**\n * Returns the prefix code for the current prefix object\n * @return the code for the current prefix object\n */\n getCode() {\n return this.code_;\n }\n\n\n /**\n * Returns the case-insensitive code for the current prefix object\n * @return the case_insensitive code for the current prefix object\n */\n getCiCode() {\n return this.ciCode_;\n }\n\n\n /**\n * Returns the prefix name for the current prefix object\n * @return the name for the current prefix object\n */\n getName() {\n return this.name_;\n }\n\n\n /**\n * Returns the print symbol for the current prefix object\n * @return the print symbol for the current prefix object\n */\n getPrintSymbol() {\n return this.printSymbol_;\n }\n\n\n /**\n * Returns the exponent for the current prefix object\n * @return the exponent for the current prefix object\n */\n getExp() {\n return this.exp_;\n }\n\n\n /**\n * Provides way to tell if one prefix equals another. The second prefix\n * must match all attribute values.\n *\n * @param prefix2 prefix object to check for a match\n * @return true for a match; false if one or more attributes don't match\n */\n equals(prefix2) {\n return this.code_ === prefix2.code_ &&\n this.ciCode_ === prefix2.ciCode_ &&\n this.name_ === prefix2.name_ &&\n this.printSymbol_ === prefix2.printSymbol_ &&\n this.value_ === prefix2.value_ &&\n this.exp_ === prefix2.exp_ ;\n }\n} // end Prefix class\n"],"mappings":";;;;;;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIA,IAAI,GAAGC,OAAO,CAAC,aAAa,CAAC;AAE1B,MAAMC,MAAM,CAAC;EAElB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,KAAK,EAAE;IAEjB,IAAIA,KAAK,CAAC,OAAO,CAAC,KAAKC,SAAS,IAAID,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,IACvDA,KAAK,CAAC,OAAO,CAAC,KAAKC,SAAS,IAAID,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,IACvDA,KAAK,CAAC,QAAQ,CAAC,KAAKC,SAAS,IAAID,KAAK,CAAC,QAAQ,CAAC,KAAK,IAAI,IACzDA,KAAK,CAAC,MAAM,CAAC,KAAKC,SAAS,EAAE;MAC/B,MAAM,IAAIC,KAAK,CAAC,6DAA6D,GAC7E,0EAA0E,GAC1E,4CAA4C,CAAC;IAC/C;;IAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACI,IAAI,CAACC,KAAK,GAAGH,KAAK,CAAC,OAAO,CAAC;;IAE3B;AACJ;AACA;IACI,IAAI,CAACI,OAAO,GAAGJ,KAAK,CAAC,SAAS,CAAC;;IAE/B;AACJ;AACA;IACI,IAAI,CAACK,KAAK,GAAGL,KAAK,CAAC,OAAO,CAAC;;IAE3B;AACJ;AACA;IACI,IAAI,CAACM,YAAY,GAAGN,KAAK,CAAC,cAAc,CAAC;;IAEzC;AACJ;AACA;IACI,IAAI,OAAOA,KAAK,CAAC,QAAQ,CAAC,KAAK,QAAQ,EACrC,IAAI,CAACO,MAAM,GAAGC,UAAU,CAACR,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAE1C,IAAI,CAACO,MAAM,GAAGP,KAAK,CAAC,QAAQ,CAAC;;IAE/B;AACJ;AACA;AACA;IACI,IAAI,CAACS,IAAI,GAAGT,KAAK,CAAC,MAAM,CAAC;EAE3B,CAAC,CAAC;;EAGF;AACF;AACA;AACA;EACEU,QAAQA,CAAA,EAAG;IACT,OAAO,IAAI,CAACH,MAAM;EACpB;;EAGA;AACF;AACA;AACA;EACEI,OAAOA,CAAA,EAAG;IACR,OAAO,IAAI,CAACR,KAAK;EACnB;;EAGA;AACF;AACA;AACA;EACES,SAASA,CAAA,EAAG;IACV,OAAO,IAAI,CAACR,OAAO;EACrB;;EAGA;AACF;AACA;AACA;EACES,OAAOA,CAAA,EAAG;IACR,OAAO,IAAI,CAACR,KAAK;EACnB;;EAGA;AACF;AACA;AACA;EACES,cAAcA,CAAA,EAAG;IACf,OAAO,IAAI,CAACR,YAAY;EAC1B;;EAGA;AACF;AACA;AACA;EACES,MAAMA,CAAA,EAAG;IACP,OAAO,IAAI,CAACN,IAAI;EAClB;;EAGA;AACF;AACA;AACA;AACA;AACA;AACA;EACEO,MAAMA,CAACC,OAAO,EAAE;IACd,OAAO,IAAI,CAACd,KAAK,KAAKc,OAAO,CAACd,KAAK,IAC3B,IAAI,CAACC,OAAO,KAAKa,OAAO,CAACb,OAAO,IAChC,IAAI,CAACC,KAAK,KAAKY,OAAO,CAACZ,KAAK,IAC5B,IAAI,CAACC,YAAY,KAAKW,OAAO,CAACX,YAAY,IAC1C,IAAI,CAACC,MAAM,KAAKU,OAAO,CAACV,MAAM,IAC9B,IAAI,CAACE,IAAI,KAAKQ,OAAO,CAACR,IAAI;EACpC;AACF,CAAC,CAAC;AAAAS,OAAA,CAAApB,MAAA,GAAAA,MAAA"}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.PrefixTables = exports.PrefixTablesFactory = void 0;
7
-
8
7
  /**
9
8
  * The tables of defined prefixes is defined in this file.
10
9
  */
@@ -28,35 +27,32 @@ class PrefixTablesFactory {
28
27
  this.byCode_ = {};
29
28
  this.byValue_ = {};
30
29
  }
30
+
31
31
  /**
32
32
  * Provides the number of prefix objects in each table
33
33
  * @returns count of the number of prefix objects in each table
34
34
  */
35
-
36
-
37
35
  prefixCount() {
38
36
  return Object.keys(this.byCode_).length;
39
37
  }
38
+
40
39
  /**
41
40
  * This is used to get all prefix objects by value. Currently it is used
42
41
  * to create a csv file with all prefixes and units.
43
42
  * @returns csv string containing all prefix objects, ordered by value.
44
43
  */
45
-
46
-
47
44
  allPrefixesByValue() {
48
45
  let prefixBuff = '';
49
- let pList = Object.keys(this.byValue_); //pList.sort() ;
50
-
46
+ let pList = Object.keys(this.byValue_);
47
+ //pList.sort() ;
51
48
  let pLen = pList.length;
52
-
53
49
  for (let p = 0; p < pLen; p++) {
54
50
  let pfx = this.getPrefixByValue(pList[p]);
55
51
  prefixBuff += pfx.code_ + ',' + pfx.name_ + ',,' + pfx.value_ + '\r\n';
56
52
  }
57
-
58
53
  return prefixBuff;
59
54
  }
55
+
60
56
  /**
61
57
  * This is used to get all prefix objects. Currently it is used
62
58
  * to get the objects to write to the json ucum definitions file
@@ -65,31 +61,27 @@ class PrefixTablesFactory {
65
61
  *
66
62
  * @returns an array containing all prefix objects, ordered by code.
67
63
  */
68
-
69
-
70
64
  allPrefixesByCode() {
71
65
  let prefixList = [];
72
66
  let pList = Object.keys(this.byCode_);
73
67
  pList.sort();
74
68
  let pLen = pList.length;
75
-
76
69
  for (let p = 0; p < pLen; p++) {
77
70
  prefixList.push(this.getPrefixByCode(pList[p]));
78
71
  }
79
-
80
72
  return prefixList;
81
73
  }
74
+
82
75
  /**
83
76
  * Adds a prefix object to the tables
84
77
  *
85
78
  * @param prefixObj the object to be added to the tables
86
79
  */
87
-
88
-
89
80
  add(prefixObj) {
90
81
  this.byCode_[prefixObj.getCode()] = prefixObj;
91
82
  this.byValue_[prefixObj.getValue()] = prefixObj;
92
83
  }
84
+
93
85
  /**
94
86
  * Tests whether a prefix object is found for a specified code. This
95
87
  * is used to determine whether or not a prefix object has been created
@@ -99,39 +91,33 @@ class PrefixTablesFactory {
99
91
  * @return boolean indicating whether or not a prefix object was found
100
92
  * for the specified code
101
93
  */
102
-
103
-
104
94
  isDefined(code) {
105
95
  return this.byCode_[code] !== null && this.byCode_[code] !== undefined;
106
96
  }
97
+
107
98
  /**
108
99
  * Obtains a prefix object for a specified code.
109
100
  *
110
101
  * @param code the code to be used to find the prefix object
111
102
  * @return the prefix object found, or null if nothing was found
112
103
  */
113
-
114
-
115
104
  getPrefixByCode(code) {
116
105
  return this.byCode_[code];
117
106
  }
107
+
118
108
  /**
119
109
  * Obtains a prefix object for a specified value.
120
110
  *
121
111
  * @param value the value to be used to find the prefix object
122
112
  * @return the prefix object found, or null if nothing was found
123
113
  */
124
-
125
-
126
114
  getPrefixByValue(value) {
127
115
  return this.byValue_[value];
128
116
  }
129
-
130
117
  } // end PrefixTablesFactory class
118
+
131
119
  // Create a singleton instance and (to preserve the existing API) an object that
132
120
  // provides that instance via getInstance().
133
-
134
-
135
121
  exports.PrefixTablesFactory = PrefixTablesFactory;
136
122
  var prefixTablesInstance = new PrefixTablesFactory();
137
123
  const PrefixTables = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../source/prefixTables.js"],"names":["PrefixTablesFactory","constructor","byCode_","byValue_","prefixCount","Object","keys","length","allPrefixesByValue","prefixBuff","pList","pLen","p","pfx","getPrefixByValue","code_","name_","value_","allPrefixesByCode","prefixList","sort","push","getPrefixByCode","add","prefixObj","getCode","getValue","isDefined","code","undefined","value","prefixTablesInstance","PrefixTables","getInstance"],"mappings":";;;;;;;AAAA;;;;AAIA;;;;;;AAMO,MAAMA,mBAAN,CAA0B;AAE/B;;;;;;;;AAQAC,EAAAA,WAAW,GAAE;AACX,SAAKC,OAAL,GAAe,EAAf;AACA,SAAKC,QAAL,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IAAoCD,SAApC;AACA,SAAKrB,QAAL,CAAcqB,SAAS,CAACE,QAAV,EAAd,IAAsCF,SAAtC;AACD;AAGD;;;;;;;;;;;AASAG,EAAAA,SAAS,CAACC,IAAD,EAAO;AACd,WAAO,KAAK1B,OAAL,CAAa0B,IAAb,MAAuB,IAAvB,IAA+B,KAAK1B,OAAL,CAAa0B,IAAb,MAAuBC,SAA7D;AACD;AAGD;;;;;;;;AAMAP,EAAAA,eAAe,CAACM,IAAD,EAAO;AACpB,WAAO,KAAK1B,OAAL,CAAa0B,IAAb,CAAP;AACD;AAGD;;;;;;;;AAMAd,EAAAA,gBAAgB,CAACgB,KAAD,EAAQ;AACtB,WAAO,KAAK3B,QAAL,CAAc2B,KAAd,CAAP;AACD;;AAzG8B,C,CA2G/B;AAGF;AACA;;;;AACA,IAAIC,oBAAoB,GAAG,IAAI/B,mBAAJ,EAA3B;AACO,MAAMgC,YAAY,GAAG;AAC1BC,EAAAA,WAAW,EAAE,YAAW;AACtB,WAAOF,oBAAP;AACD;AAHyB,CAArB","sourcesContent":["/**\n * The tables of defined prefixes is defined in this file.\n */\n\n/**\n * This class implements the table of multiplier prefixes.\n *\n * @author Lee Mericle, based on java version by Gunther Schadow\n *\n */\nexport class PrefixTablesFactory {\n\n /**\n * Constructor. This creates the empty PrefixTable hashes once.\n * There is one hash whose key is the prefix code and one whose\n * key is the prefix value.\n *\n * Implementation of this as a singleton is based on the UnitTables\n * implementation. See that class for details.\n */\n constructor(){\n this.byCode_ = {} ;\n this.byValue_ = {};\n }\n\n\n /**\n * Provides the number of prefix objects in each table\n * @returns count of the number of prefix objects in each table\n */\n prefixCount() {\n return Object.keys(this.byCode_).length ;\n }\n\n\n /**\n * This is used to get all prefix objects by value. Currently it is used\n * to create a csv file with all prefixes and units.\n * @returns csv string containing all prefix objects, ordered by value.\n */\n allPrefixesByValue() {\n let prefixBuff = '';\n let pList = Object.keys(this.byValue_);\n //pList.sort() ;\n let pLen = pList.length;\n for (let p = 0; p < pLen; p++) {\n let pfx = this.getPrefixByValue(pList[p]) ;\n prefixBuff += pfx.code_ + ',' + pfx.name_ + ',,' + pfx.value_ + '\\r\\n';\n }\n return prefixBuff ;\n }\n\n /**\n * This is used to get all prefix objects. Currently it is used\n * to get the objects to write to the json ucum definitions file\n * that is used to provide prefix and unit definition objects for\n * conversions and validations.\n *\n * @returns an array containing all prefix objects, ordered by code.\n */\n allPrefixesByCode() {\n let prefixList = [];\n let pList = Object.keys(this.byCode_);\n pList.sort() ;\n let pLen = pList.length;\n for (let p = 0; p < pLen; p++) {\n prefixList.push(this.getPrefixByCode(pList[p])) ;\n }\n return prefixList ;\n }\n\n /**\n * Adds a prefix object to the tables\n *\n * @param prefixObj the object to be added to the tables\n */\n add(prefixObj){\n this.byCode_[prefixObj.getCode()] = prefixObj;\n this.byValue_[prefixObj.getValue()] = prefixObj;\n }\n\n\n /**\n * Tests whether a prefix object is found for a specified code. This\n * is used to determine whether or not a prefix object has been created\n * for the code.\n *\n * @param code the code to be used to find the prefix object\n * @return boolean indicating whether or not a prefix object was found\n * for the specified code\n */\n isDefined(code) {\n return this.byCode_[code] !== null && this.byCode_[code] !== undefined ;\n }\n\n\n /**\n * Obtains a prefix object for a specified code.\n *\n * @param code the code to be used to find the prefix object\n * @return the prefix object found, or null if nothing was found\n */\n getPrefixByCode(code) {\n return this.byCode_[code];\n }\n\n\n /**\n * Obtains a prefix object for a specified value.\n *\n * @param value the value to be used to find the prefix object\n * @return the prefix object found, or null if nothing was found\n */\n getPrefixByValue(value) {\n return this.byValue_[value];\n }\n\n} // end PrefixTablesFactory class\n\n\n// Create a singleton instance and (to preserve the existing API) an object that\n// provides that instance via getInstance().\nvar prefixTablesInstance = new PrefixTablesFactory();\nexport const PrefixTables = {\n getInstance: function() {\n return prefixTablesInstance;\n }\n}\n"],"file":"prefixTables.js"}
1
+ {"version":3,"file":"prefixTables.js","names":["PrefixTablesFactory","constructor","byCode_","byValue_","prefixCount","Object","keys","length","allPrefixesByValue","prefixBuff","pList","pLen","p","pfx","getPrefixByValue","code_","name_","value_","allPrefixesByCode","prefixList","sort","push","getPrefixByCode","add","prefixObj","getCode","getValue","isDefined","code","undefined","value","exports","prefixTablesInstance","PrefixTables","getInstance"],"sources":["../source/prefixTables.js"],"sourcesContent":["/**\n * The tables of defined prefixes is defined in this file.\n */\n\n/**\n * This class implements the table of multiplier prefixes.\n *\n * @author Lee Mericle, based on java version by Gunther Schadow\n *\n */\nexport class PrefixTablesFactory {\n\n /**\n * Constructor. This creates the empty PrefixTable hashes once.\n * There is one hash whose key is the prefix code and one whose\n * key is the prefix value.\n *\n * Implementation of this as a singleton is based on the UnitTables\n * implementation. See that class for details.\n */\n constructor(){\n this.byCode_ = {} ;\n this.byValue_ = {};\n }\n\n\n /**\n * Provides the number of prefix objects in each table\n * @returns count of the number of prefix objects in each table\n */\n prefixCount() {\n return Object.keys(this.byCode_).length ;\n }\n\n\n /**\n * This is used to get all prefix objects by value. Currently it is used\n * to create a csv file with all prefixes and units.\n * @returns csv string containing all prefix objects, ordered by value.\n */\n allPrefixesByValue() {\n let prefixBuff = '';\n let pList = Object.keys(this.byValue_);\n //pList.sort() ;\n let pLen = pList.length;\n for (let p = 0; p < pLen; p++) {\n let pfx = this.getPrefixByValue(pList[p]) ;\n prefixBuff += pfx.code_ + ',' + pfx.name_ + ',,' + pfx.value_ + '\\r\\n';\n }\n return prefixBuff ;\n }\n\n /**\n * This is used to get all prefix objects. Currently it is used\n * to get the objects to write to the json ucum definitions file\n * that is used to provide prefix and unit definition objects for\n * conversions and validations.\n *\n * @returns an array containing all prefix objects, ordered by code.\n */\n allPrefixesByCode() {\n let prefixList = [];\n let pList = Object.keys(this.byCode_);\n pList.sort() ;\n let pLen = pList.length;\n for (let p = 0; p < pLen; p++) {\n prefixList.push(this.getPrefixByCode(pList[p])) ;\n }\n return prefixList ;\n }\n\n /**\n * Adds a prefix object to the tables\n *\n * @param prefixObj the object to be added to the tables\n */\n add(prefixObj){\n this.byCode_[prefixObj.getCode()] = prefixObj;\n this.byValue_[prefixObj.getValue()] = prefixObj;\n }\n\n\n /**\n * Tests whether a prefix object is found for a specified code. This\n * is used to determine whether or not a prefix object has been created\n * for the code.\n *\n * @param code the code to be used to find the prefix object\n * @return boolean indicating whether or not a prefix object was found\n * for the specified code\n */\n isDefined(code) {\n return this.byCode_[code] !== null && this.byCode_[code] !== undefined ;\n }\n\n\n /**\n * Obtains a prefix object for a specified code.\n *\n * @param code the code to be used to find the prefix object\n * @return the prefix object found, or null if nothing was found\n */\n getPrefixByCode(code) {\n return this.byCode_[code];\n }\n\n\n /**\n * Obtains a prefix object for a specified value.\n *\n * @param value the value to be used to find the prefix object\n * @return the prefix object found, or null if nothing was found\n */\n getPrefixByValue(value) {\n return this.byValue_[value];\n }\n\n} // end PrefixTablesFactory class\n\n\n// Create a singleton instance and (to preserve the existing API) an object that\n// provides that instance via getInstance().\nvar prefixTablesInstance = new PrefixTablesFactory();\nexport const PrefixTables = {\n getInstance: function() {\n return prefixTablesInstance;\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,CAAC;EAE/B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAAA,EAAE;IACX,IAAI,CAACC,OAAO,GAAG,CAAC,CAAC;IACjB,IAAI,CAACC,QAAQ,GAAG,CAAC,CAAC;EACpB;;EAGA;AACF;AACA;AACA;EACEC,WAAWA,CAAA,EAAG;IACZ,OAAOC,MAAM,CAACC,IAAI,CAAC,IAAI,CAACJ,OAAO,CAAC,CAACK,MAAM;EACzC;;EAGA;AACF;AACA;AACA;AACA;EACEC,kBAAkBA,CAAA,EAAG;IACnB,IAAIC,UAAU,GAAG,EAAE;IACnB,IAAIC,KAAK,GAAGL,MAAM,CAACC,IAAI,CAAC,IAAI,CAACH,QAAQ,CAAC;IACtC;IACA,IAAIQ,IAAI,GAAGD,KAAK,CAACH,MAAM;IACvB,KAAK,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F;AACA;AACA;AACA;AACA;EACEP,eAAeA,CAACM,IAAI,EAAE;IACpB,OAAO,IAAI,CAAC1B,OAAO,CAAC0B,IAAI,CAAC;EAC3B;;EAGA;AACF;AACA;AACA;AACA;AACA;EACEd,gBAAgBA,CAACgB,KAAK,EAAE;IACtB,OAAO,IAAI,CAAC3B,QAAQ,CAAC2B,KAAK,CAAC;EAC7B;AAEF,CAAC,CAAC;;AAGF;AACA;AAAAC,OAAA,CAAA/B,mBAAA,GAAAA,mBAAA;AACA,IAAIgC,oBAAoB,GAAG,IAAIhC,mBAAmB,CAAC,CAAC;AAC7C,MAAMiC,YAAY,GAAG;EAC1BC,WAAW,EAAE,SAAAA,CAAA,EAAW;IACtB,OAAOF,oBAAoB;EAC7B;AACF,CAAC;AAAAD,OAAA,CAAAE,YAAA,GAAAA,YAAA"}
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /*
9
8
  * This class manages the special functions used by some units.
10
9
  *
11
10
  * @author Lee Mericle, based on java version by Gunther Schadow
12
11
  *
13
12
  */
13
+
14
14
  class UcumFunctions {
15
15
  /**
16
16
  * Constructor
@@ -20,9 +20,10 @@ class UcumFunctions {
20
20
  */
21
21
  constructor() {
22
22
  // Create the hash containing the function pairs
23
- this.funcs = {}; // Celsius - convert to Celsius from kelvin and from Celsius to kelvin
24
- // where kelvin is the base unit for temperature
23
+ this.funcs = {};
25
24
 
25
+ // Celsius - convert to Celsius from kelvin and from Celsius to kelvin
26
+ // where kelvin is the base unit for temperature
26
27
  this.funcs['cel'] = {
27
28
  cnvTo: function (x) {
28
29
  return x - 273.15;
@@ -30,9 +31,10 @@ class UcumFunctions {
30
31
  cnvFrom: function (x) {
31
32
  return x + 273.15;
32
33
  }
33
- }; // Fahrenheit - convert to Fahrenheit from kelvin and from Fahrenheit to
34
- // kelvin - which is the base unit for temperature
34
+ };
35
35
 
36
+ // Fahrenheit - convert to Fahrenheit from kelvin and from Fahrenheit to
37
+ // kelvin - which is the base unit for temperature
36
38
  this.funcs['degf'] = {
37
39
  cnvTo: function (x) {
38
40
  return x - 459.67;
@@ -40,13 +42,14 @@ class UcumFunctions {
40
42
  cnvFrom: function (x) {
41
43
  return x + 459.67;
42
44
  }
43
- }; // Reaumur - convert between Reaumur and Kelvin. Because of the way the
45
+ };
46
+
47
+ // Reaumur - convert between Reaumur and Kelvin. Because of the way the
44
48
  // calling code in the Units class is set up (in the convertFrom method),
45
49
  // what is given here as the convertTo function is actually the convert
46
50
  // from method and vice versa.
47
51
  //this.funcs['degre'] = {cnvTo : function(x){return x + 273.15;},
48
52
  // cnvFrom : function(x){return x - 273.15;}};
49
-
50
53
  this.funcs['degre'] = {
51
54
  cnvTo: function (x) {
52
55
  return x - 273.15;
@@ -54,9 +57,10 @@ class UcumFunctions {
54
57
  cnvFrom: function (x) {
55
58
  return x + 273.15;
56
59
  }
57
- }; // pH - convert to pH from moles per liter and from moles per liter to pH
58
- // where a mole is an amount of a substance (a count of particles)
60
+ };
59
61
 
62
+ // pH - convert to pH from moles per liter and from moles per liter to pH
63
+ // where a mole is an amount of a substance (a count of particles)
60
64
  this.funcs['ph'] = {
61
65
  cnvTo: function (x) {
62
66
  return -Math.log(x) / Math.LN10;
@@ -64,9 +68,10 @@ class UcumFunctions {
64
68
  cnvFrom: function (x) {
65
69
  return Math.pow(10, -x);
66
70
  }
67
- }; // ln - natural logarithm (base e 2.71828) - apply (cnvTo) and invert (cnvFrom)
68
- // and 2ln - two times the natural logarithm
71
+ };
69
72
 
73
+ // ln - natural logarithm (base e 2.71828) - apply (cnvTo) and invert (cnvFrom)
74
+ // and 2ln - two times the natural logarithm
70
75
  this.funcs['ln'] = {
71
76
  cnvTo: function (x) {
72
77
  return Math.log(x);
@@ -82,8 +87,9 @@ class UcumFunctions {
82
87
  cnvFrom: function (x) {
83
88
  return Math.exp(x / 2);
84
89
  }
85
- }; // lg - the decadic logarithm (base 10)
90
+ };
86
91
 
92
+ // lg - the decadic logarithm (base 10)
87
93
  this.funcs['lg'] = {
88
94
  cnvTo: function (x) {
89
95
  return Math.log(x) / Math.LN10;
@@ -107,8 +113,8 @@ class UcumFunctions {
107
113
  cnvFrom: function (x) {
108
114
  return Math.pow(10, x / 20);
109
115
  }
110
- }; // The plain text ucum units file uses '2lg'
111
-
116
+ };
117
+ // The plain text ucum units file uses '2lg'
112
118
  this.funcs['2lg'] = {
113
119
  cnvTo: function (x) {
114
120
  return 2 * Math.log(x) / Math.LN10;
@@ -116,10 +122,11 @@ class UcumFunctions {
116
122
  cnvFrom: function (x) {
117
123
  return Math.pow(10, x / 2);
118
124
  }
119
- }; // The xml essence ucum file uses lgTimes2
120
-
121
- this.funcs['lgtimes2'] = this.funcs['2lg']; // ld - dual logarithm (base 2)
125
+ };
126
+ // The xml essence ucum file uses lgTimes2
127
+ this.funcs['lgtimes2'] = this.funcs['2lg'];
122
128
 
129
+ // ld - dual logarithm (base 2)
123
130
  this.funcs['ld'] = {
124
131
  cnvTo: function (x) {
125
132
  return Math.log(x) / Math.LN2;
@@ -127,8 +134,9 @@ class UcumFunctions {
127
134
  cnvFrom: function (x) {
128
135
  return Math.pow(2, x);
129
136
  }
130
- }; // tan - tangent
137
+ };
131
138
 
139
+ // tan - tangent
132
140
  this.funcs['100tan'] = {
133
141
  cnvTo: function (x) {
134
142
  return Math.tan(x) * 100;
@@ -136,10 +144,11 @@ class UcumFunctions {
136
144
  cnvFrom: function (x) {
137
145
  return Math.atan(x / 100);
138
146
  }
139
- }; // the xml essence ucum file uses both 100tan and tanTimes100
140
-
141
- this.funcs['tanTimes100'] = this.funcs['100tan']; // sqrt - square root
147
+ };
148
+ // the xml essence ucum file uses both 100tan and tanTimes100
149
+ this.funcs['tanTimes100'] = this.funcs['100tan'];
142
150
 
151
+ // sqrt - square root
143
152
  this.funcs['sqrt'] = {
144
153
  cnvTo: function (x) {
145
154
  return Math.sqrt(x);
@@ -147,8 +156,9 @@ class UcumFunctions {
147
156
  cnvFrom: function (x) {
148
157
  return x * x;
149
158
  }
150
- }; // inv - inverse
159
+ };
151
160
 
161
+ // inv - inverse
152
162
  this.funcs['inv'] = {
153
163
  cnvTo: function (x) {
154
164
  return 1.0 / x;
@@ -156,8 +166,9 @@ class UcumFunctions {
156
166
  cnvFrom: function (x) {
157
167
  return 1.0 / x;
158
168
  }
159
- }; // homeopathic potency functions
169
+ };
160
170
 
171
+ // homeopathic potency functions
161
172
  this.funcs['hpX'] = {
162
173
  cnvTo: function (x) {
163
174
  return -this.funcs['lg'](x);
@@ -199,14 +210,13 @@ class UcumFunctions {
199
210
  * @return the function with the specified name
200
211
  * @throws an error message if the function is not found
201
212
  */
202
-
203
-
204
213
  forName(fname) {
205
214
  fname = fname.toLowerCase();
206
215
  let f = this.funcs[fname];
207
216
  if (f === null) throw new Error(`Requested function ${fname} is not defined`);
208
217
  return f;
209
218
  }
219
+
210
220
  /**
211
221
  * Returns a flag indicating whether or not the function has been
212
222
  * defined.
@@ -214,18 +224,11 @@ class UcumFunctions {
214
224
  * @param fname name of the function in question
215
225
  * @return true if it has been defined; false if not
216
226
  */
217
-
218
-
219
227
  isDefined(fname) {
220
228
  fname = fname.toLowerCase();
221
229
  return this.funcs[fname] !== null;
222
230
  }
223
-
224
231
  } // end of UcumFunctions class
225
-
226
-
227
232
  var _default = new UcumFunctions(); // one singleton instance
228
-
229
-
230
233
  exports.default = _default;
231
234
  //# sourceMappingURL=ucumFunctions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../source/ucumFunctions.js"],"names":["UcumFunctions","constructor","funcs","cnvTo","x","cnvFrom","Math","log","LN10","pow","exp","LN2","tan","atan","sqrt","func","forName","fname","toLowerCase","f","Error","isDefined"],"mappings":";;;;;;;AAAA;;;;;;AAOA,MAAMA,aAAN,CAAoB;AAElB;;;;;;AAMAC,EAAAA,WAAW,GAAG;AAEZ;AACA,SAAKC,KAAL,GAAa,EAAb,CAHY,CAKZ;AACA;;AACA,SAAKA,KAAL,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uB,KAAKF,KAAL,CAAW,IAAX,EAAiB,IAAjB,CAA9B;AAAsD,OAD5D;AAEFG,MAAAA,OAAO,EAAG,UAASD,CAAT,EAAW;AAAC,eAAOE,IAAI,CAACG,GAAL,CAAS,IAAT,EAAe,CAACL,CAAhB,CAAP;AAA2B;AAF/C,KAApB;AAIA,SAAKF,KAAL,CAAW,KAAX,IAAoB;AAACC,MAAAA,KAAK,EAAG,UAASC,CAAT,EAAW;AACd,eAAO,CAAE,KAAKF,KAAL,CAAW,IAAX,EAAiBE,CAAjB,CAAF,GAAuB,KAAKF,KAAL,CAAW,IAAX,EAAiB,KAAjB,CAA9B;AAAuD,OAD7D;AAEFG,MAAAA,OAAO,EAAG,UAASD,CAAT,EAAW;AAAC,eAAOE,IAAI,CAACG,GAAL,CAAS,KAAT,EAAgB,CAACL,CAAjB,CAAP;AAA4B;AAFhD,KAApB;AAID,GA3FiB,CA2FhB;;AAGF;;;;;;;;;AAOAY,EAAAA,OAAO,CAACC,KAAD,EAAQ;AACbA,IAAAA,KAAK,GAAGA,KAAK,CAACC,WAAN,EAAR;AAEA,QAAIC,CAAC,GAAG,KAAKjB,KAAL,CAAWe,KAAX,CAAR;AACA,QAAIE,CAAC,KAAK,IAAV,EACE,MAAM,IAAIC,KAAJ,CAAW,sBAAqBH,KAAM,iBAAtC,CAAN;AACF,WAAOE,CAAP;AACD;AAGD;;;;;;;;;AAOAE,EAAAA,SAAS,CAACJ,KAAD,EAAQ;AACfA,IAAAA,KAAK,GAAGA,KAAK,CAACC,WAAN,EAAR;AACA,WAAO,KAAKhB,KAAL,CAAWe,KAAX,MAAsB,IAA7B;AACD;;AAzHiB,C,CA2HlB;;;eAEa,IAAIjB,aAAJ,E,EAAqB","sourcesContent":["/*\n * This class manages the special functions used by some units.\n *\n * @author Lee Mericle, based on java version by Gunther Schadow\n *\n */\n\nclass UcumFunctions {\n\n /**\n * Constructor\n *\n * Creates the singleton object that contains the list of functions used\n * to convert special units.\n */\n constructor() {\n\n // Create the hash containing the function pairs\n this.funcs = {};\n\n // Celsius - convert to Celsius from kelvin and from Celsius to kelvin\n // where kelvin is the base unit for temperature\n this.funcs['cel'] = {cnvTo : function(x){return x - 273.15;},\n cnvFrom : function(x){return x + 273.15;}};\n\n // Fahrenheit - convert to Fahrenheit from kelvin and from Fahrenheit to\n // kelvin - which is the base unit for temperature\n this.funcs['degf'] = {cnvTo : function(x){return x - 459.67;},\n cnvFrom : function(x){return x + 459.67;}};\n\n // Reaumur - convert between Reaumur and Kelvin. Because of the way the\n // calling code in the Units class is set up (in the convertFrom method),\n // what is given here as the convertTo function is actually the convert\n // from method and vice versa.\n //this.funcs['degre'] = {cnvTo : function(x){return x + 273.15;},\n // cnvFrom : function(x){return x - 273.15;}};\n this.funcs['degre'] = {cnvTo : function(x){return x - 273.15;},\n cnvFrom : function(x){return x + 273.15;}};\n\n // pH - convert to pH from moles per liter and from moles per liter to pH\n // where a mole is an amount of a substance (a count of particles)\n this.funcs['ph'] = {cnvTo : function(x){return - Math.log(x) / Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, -x);}};\n\n // ln - natural logarithm (base e 2.71828) - apply (cnvTo) and invert (cnvFrom)\n // and 2ln - two times the natural logarithm\n this.funcs['ln'] = {cnvTo : function(x){return Math.log(x);},\n cnvFrom : function(x){return Math.exp(x);}};\n this.funcs['2ln'] = {cnvTo : function(x){return 2 * Math.log(x);},\n cnvFrom : function(x){return Math.exp(x / 2);}};\n\n // lg - the decadic logarithm (base 10)\n this.funcs['lg'] = {cnvTo : function(x){return Math.log(x) / Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x);}};\n this.funcs['10lg'] = {cnvTo : function(x){return 10 * Math.log(x)/Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x / 10);}};\n this.funcs['20lg'] = {cnvTo : function(x){return 20 * Math.log(x)/Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x / 20);}};\n // The plain text ucum units file uses '2lg'\n this.funcs['2lg'] = {cnvTo : function(x){return 2 * Math.log(x)/Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x / 2);}};\n // The xml essence ucum file uses lgTimes2\n this.funcs['lgtimes2'] = this.funcs['2lg'];\n\n // ld - dual logarithm (base 2)\n this.funcs['ld'] = {cnvTo : function(x){return Math.log(x)/Math.LN2;},\n cnvFrom : function(x){return Math.pow(2, x);}};\n\n // tan - tangent\n this.funcs['100tan'] = {cnvTo : function(x){return Math.tan(x) * 100;},\n cnvFrom : function(x){return Math.atan(x/100);}};\n // the xml essence ucum file uses both 100tan and tanTimes100\n this.funcs['tanTimes100'] = this.funcs['100tan'] ;\n\n // sqrt - square root\n this.funcs['sqrt'] = {cnvTo : function(x){return Math.sqrt(x);},\n cnvFrom : function(x){return x*x;}};\n\n // inv - inverse\n this.funcs['inv'] = {cnvTo : function(x){return 1.0 / x;},\n cnvFrom : function(x){return 1.0 / x;}};\n\n // homeopathic potency functions\n this.funcs['hpX'] = {cnvTo : function(x){return -(this.funcs['lg'](x));},\n cnvFrom : function(x){return Math.pow(10, -x);}};\n\n this.funcs['hpC'] = {cnvTo : function(x){\n return -(this.func['ln'](x))/this.funcs['ln'](100);},\n cnvFrom : function(x){return Math.pow(100, -x);}};\n\n this.funcs['hpM'] = {cnvTo : function(x){\n return -(this.funcs['ln'](x))/this.funcs['ln'](1000);},\n cnvFrom : function(x){return Math.pow(1000, -x);}};\n\n this.funcs['hpQ'] = {cnvTo : function(x){\n return -(this.funcs['ln'](x))/this.funcs['ln'](50000);},\n cnvFrom : function(x){return Math.pow(50000, -x);}};\n\n } // end of constructor\n\n\n /**\n * Returns the function with the name specified\n *\n * @param fname name of the function to be returned\n * @return the function with the specified name\n * @throws an error message if the function is not found\n */\n forName(fname) {\n fname = fname.toLowerCase();\n\n let f = this.funcs[fname] ;\n if (f === null)\n throw(new Error(`Requested function ${fname} is not defined`));\n return f;\n }\n\n\n /**\n * Returns a flag indicating whether or not the function has been\n * defined.\n *\n * @param fname name of the function in question\n * @return true if it has been defined; false if not\n */\n isDefined(fname) {\n fname = fname.toLowerCase();\n return this.funcs[fname] !== null;\n }\n\n} // end of UcumFunctions class\n\nexport default new UcumFunctions(); // one singleton instance\n"],"file":"ucumFunctions.js"}
1
+ {"version":3,"file":"ucumFunctions.js","names":["UcumFunctions","constructor","funcs","cnvTo","x","cnvFrom","Math","log","LN10","pow","exp","LN2","tan","atan","sqrt","func","forName","fname","toLowerCase","f","Error","isDefined","_default","exports","default"],"sources":["../source/ucumFunctions.js"],"sourcesContent":["/*\n * This class manages the special functions used by some units.\n *\n * @author Lee Mericle, based on java version by Gunther Schadow\n *\n */\n\nclass UcumFunctions {\n\n /**\n * Constructor\n *\n * Creates the singleton object that contains the list of functions used\n * to convert special units.\n */\n constructor() {\n\n // Create the hash containing the function pairs\n this.funcs = {};\n\n // Celsius - convert to Celsius from kelvin and from Celsius to kelvin\n // where kelvin is the base unit for temperature\n this.funcs['cel'] = {cnvTo : function(x){return x - 273.15;},\n cnvFrom : function(x){return x + 273.15;}};\n\n // Fahrenheit - convert to Fahrenheit from kelvin and from Fahrenheit to\n // kelvin - which is the base unit for temperature\n this.funcs['degf'] = {cnvTo : function(x){return x - 459.67;},\n cnvFrom : function(x){return x + 459.67;}};\n\n // Reaumur - convert between Reaumur and Kelvin. Because of the way the\n // calling code in the Units class is set up (in the convertFrom method),\n // what is given here as the convertTo function is actually the convert\n // from method and vice versa.\n //this.funcs['degre'] = {cnvTo : function(x){return x + 273.15;},\n // cnvFrom : function(x){return x - 273.15;}};\n this.funcs['degre'] = {cnvTo : function(x){return x - 273.15;},\n cnvFrom : function(x){return x + 273.15;}};\n\n // pH - convert to pH from moles per liter and from moles per liter to pH\n // where a mole is an amount of a substance (a count of particles)\n this.funcs['ph'] = {cnvTo : function(x){return - Math.log(x) / Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, -x);}};\n\n // ln - natural logarithm (base e 2.71828) - apply (cnvTo) and invert (cnvFrom)\n // and 2ln - two times the natural logarithm\n this.funcs['ln'] = {cnvTo : function(x){return Math.log(x);},\n cnvFrom : function(x){return Math.exp(x);}};\n this.funcs['2ln'] = {cnvTo : function(x){return 2 * Math.log(x);},\n cnvFrom : function(x){return Math.exp(x / 2);}};\n\n // lg - the decadic logarithm (base 10)\n this.funcs['lg'] = {cnvTo : function(x){return Math.log(x) / Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x);}};\n this.funcs['10lg'] = {cnvTo : function(x){return 10 * Math.log(x)/Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x / 10);}};\n this.funcs['20lg'] = {cnvTo : function(x){return 20 * Math.log(x)/Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x / 20);}};\n // The plain text ucum units file uses '2lg'\n this.funcs['2lg'] = {cnvTo : function(x){return 2 * Math.log(x)/Math.LN10;},\n cnvFrom : function(x){return Math.pow(10, x / 2);}};\n // The xml essence ucum file uses lgTimes2\n this.funcs['lgtimes2'] = this.funcs['2lg'];\n\n // ld - dual logarithm (base 2)\n this.funcs['ld'] = {cnvTo : function(x){return Math.log(x)/Math.LN2;},\n cnvFrom : function(x){return Math.pow(2, x);}};\n\n // tan - tangent\n this.funcs['100tan'] = {cnvTo : function(x){return Math.tan(x) * 100;},\n cnvFrom : function(x){return Math.atan(x/100);}};\n // the xml essence ucum file uses both 100tan and tanTimes100\n this.funcs['tanTimes100'] = this.funcs['100tan'] ;\n\n // sqrt - square root\n this.funcs['sqrt'] = {cnvTo : function(x){return Math.sqrt(x);},\n cnvFrom : function(x){return x*x;}};\n\n // inv - inverse\n this.funcs['inv'] = {cnvTo : function(x){return 1.0 / x;},\n cnvFrom : function(x){return 1.0 / x;}};\n\n // homeopathic potency functions\n this.funcs['hpX'] = {cnvTo : function(x){return -(this.funcs['lg'](x));},\n cnvFrom : function(x){return Math.pow(10, -x);}};\n\n this.funcs['hpC'] = {cnvTo : function(x){\n return -(this.func['ln'](x))/this.funcs['ln'](100);},\n cnvFrom : function(x){return Math.pow(100, -x);}};\n\n this.funcs['hpM'] = {cnvTo : function(x){\n return -(this.funcs['ln'](x))/this.funcs['ln'](1000);},\n cnvFrom : function(x){return Math.pow(1000, -x);}};\n\n this.funcs['hpQ'] = {cnvTo : function(x){\n return -(this.funcs['ln'](x))/this.funcs['ln'](50000);},\n cnvFrom : function(x){return Math.pow(50000, -x);}};\n\n } // end of constructor\n\n\n /**\n * Returns the function with the name specified\n *\n * @param fname name of the function to be returned\n * @return the function with the specified name\n * @throws an error message if the function is not found\n */\n forName(fname) {\n fname = fname.toLowerCase();\n\n let f = this.funcs[fname] ;\n if (f === null)\n throw(new Error(`Requested function ${fname} is not defined`));\n return f;\n }\n\n\n /**\n * Returns a flag indicating whether or not the function has been\n * defined.\n *\n * @param fname name of the function in question\n * @return true if it has been defined; false if not\n */\n isDefined(fname) {\n fname = fname.toLowerCase();\n return this.funcs[fname] !== null;\n }\n\n} // end of UcumFunctions class\n\nexport default new UcumFunctions(); // one singleton instance\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,aAAa,CAAC;EAElB;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAAA,EAAG;IAEZ;IACA,IAAI,CAACC,KAAK,GAAG,CAAC,CAAC;;IAEf;IACA;IACA,IAAI,CAACA,KAAK,CAAC,KAAK,CAAC,GAAG;MAACC,KAAK,EAAK,SAAAA,CAASC,CAAC,EAAC;QAAC,OAAOA,CAAC,GAAG,MAAM;MAAC,CAAC;MAC5CC,OAAO,EAAG,SAAAA,CAASD,CAAC,EAAC;QAAC,OAAOA,CAAC,GAAG,MAAM;MAAC;IAAC,CAAC;;IAE5D;IACA;IACA,IAAI,CAACF,KAAK,CAAC,MAAM,CAAC,GAAG;MAACC,KAAK,EAAK,SAAAA,CAASC,CAAC,EAAC;QAAC,OAAOA,CAAC,GAAG,MAAM;MAAC,CAAC;MAC5CC,OAAO,EAAG,SAAAA,CAASD,CAAC,EAAC;QAAC,OAAOA,CAAC,GAAG,MAAM;MAAC;IAAC,CA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