@returns {{ [groupName: string]: string }}
()
| 95 | |
| 96 | /** @returns {{ [groupName: string]: string }} */ |
| 97 | usedUnits() { |
| 98 | /** @type {{ [unitName: string]: number }} */ |
| 99 | let group; |
| 100 | /** @type {{ [groupName: string]: string }} */ |
| 101 | const result = {}; |
| 102 | /** @type {(atomicUnit: string) => string} */ |
| 103 | let mapUnit; |
| 104 | /** @type {string} */ |
| 105 | let groupName; |
| 106 | |
| 107 | mapUnit = function (atomicUnit) { |
| 108 | // eslint-disable-next-line no-prototype-builtins |
| 109 | if (group.hasOwnProperty(atomicUnit) && !result[groupName]) { |
| 110 | result[groupName] = atomicUnit; |
| 111 | } |
| 112 | |
| 113 | return atomicUnit; |
| 114 | }; |
| 115 | |
| 116 | for (groupName in unitConversions) { |
| 117 | // eslint-disable-next-line no-prototype-builtins |
| 118 | if (unitConversions.hasOwnProperty(groupName)) { |
| 119 | group = /** @type {{ [unitName: string]: number }} */ (unitConversions[/** @type {keyof typeof unitConversions} */ (groupName)]); |
| 120 | |
| 121 | this.map(mapUnit); |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | return result; |
| 126 | } |
| 127 | |
| 128 | cancel() { |
| 129 | /** @type {{ [unit: string]: number }} */ |