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ert-units@2.3.4/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/convert-units@2.3.4/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var convert\n  , keys = require('lodash.keys')\n  , each = require('lodash.foreach')\n  , measures = {\n      length: require('./definitions/length')\n    , area: require('./definitions/area')\n    , mass: require('./definitions/mass')\n    , volume: require('./definitions/volume')\n    , each: require('./definitions/each')\n    , temperature: require('./definitions/temperature')\n    , time: require('./definitions/time')\n    , digital: require('./definitions/digital')\n    , partsPer: require('./definitions/partsPer')\n    , speed: require('./definitions/speed')\n    , pace: require('./definitions/pace')\n    , pressure: require('./definitions/pressure')\n    , current: require('./definitions/current')\n    , voltage: require('./definitions/voltage')\n    , power: require('./definitions/power')\n    , reactivePower: require('./definitions/reactivePower')\n    , apparentPower: require('./definitions/apparentPower')\n    , energy: require('./definitions/energy')\n    , reactiveEnergy: require('./definitions/reactiveEnergy')\n    , volumeFlowRate: require('./definitions/volumeFlowRate')\n    , illuminance: require('./definitions/illuminance')\n    , frequency: require('./definitions/frequency')\n    , angle : require('./definitions/angle')\n    }\n  , Converter;\n\nConverter = function (numerator, denominator) {\n  if(denominator)\n    this.val = numerator / denominator;\n  else\n    this.val = numerator;\n};\n\n/**\n* Lets the converter know the source unit abbreviation\n*/\nConverter.prototype.from = function (from) {\n  if(this.destination)\n    throw new Error('.from must be called before .to');\n\n  this.origin = this.getUnit(from);\n\n  if(!this.origin) {\n    this.throwUnsupportedUnitError(from);\n  }\n\n  return this;\n};\n\n/**\n* Converts the unit and returns the value\n*/\nConverter.prototype.to = function (to) {\n  if(!this.origin)\n    throw new Error('.to must be called after .from');\n\n  this.destination = this.getUnit(to);\n\n  var result\n    , transform;\n\n  if(!this.destination) {\n    this.throwUnsupportedUnitError(to);\n  }\n\n  // Don't change the value if origin and destination are the same\n  if (this.origin.abbr === this.destination.abbr) {\n    return this.val;\n  }\n\n  // You can't go from liquid to mass, for example\n  if(this.destination.measure != this.origin.measure) {\n    throw new Error('Cannot convert incompatible measures of '\n      + this.destination.measure + ' and ' + this.origin.measure);\n  }\n\n  /**\n  * Convert from the source value to its anchor inside the system\n  */\n  result = this.val * this.origin.unit.to_anchor;\n\n  /**\n  * For some changes it's a simple shift (C to K)\n  * So we'll add it when convering into the unit (later)\n  * and subtract it when converting from the unit\n  */\n  if (this.origin.unit.anchor_shift) {\n    result -= this.origin.unit.anchor_shift\n  }\n\n  /**\n  * Convert from one system to another through the anchor ratio. Some conversions\n  * aren't ratio based or require more than a simple shift. We can provide a custom\n  * transform here to provide the direct result\n  */\n  if(this.origin.system != this.destination.system) {\n    transform = measures[this.origin.measure]._anchors[this.origin.system].transform;\n    if (typeof transform === 'function') {\n      result = transform(result)\n    }\n    else {\n      result *= measures[this.origin.measure]._anchors[this.origin.system].ratio;\n    }\n  }\n\n  /**\n  * This shift has to be done after the system conversion business\n  */\n  if (this.destination.unit.anchor_shift) {\n    result += this.destination.unit.anchor_shift;\n  }\n\n  /**\n  * Convert to another unit inside the destination system\n  */\n  return result / this.destination.unit.to_anchor;\n};\n\n/**\n* Converts the unit to the best available unit.\n*/\nConverter.prototype.toBest = function(options) {\n  if(!this.origin)\n    throw new Error('.toBest must be called after .from');\n\n  var options = Object.assign({\n    exclude: [],\n    cutOffNumber: 1,\n  }, options)\n\n  var best;\n  /**\n    Looks through every possibility for the 'best' available unit.\n    i.e. Where the value has the fewest numbers before the decimal point,\n    but is still higher than 1.\n  */\n  each(this.possibilities(), function(possibility) {\n    var unit = this.describe(possibility);\n    var isIncluded = options.exclude.indexOf(possibility) === -1;\n\n    if (isIncluded && unit.system === this.origin.system) {\n      var result = this.to(possibility);\n      if (!best || (result >= options.cutOffNumber && result < best.val)) {\n        best = {\n          val: result,\n          unit: possibility,\n          singular: unit.singular,\n          plural: unit.plural\n        };\n      }\n    }\n  }.bind(this));\n\n  return best;\n}\n\n/**\n* Finds the unit\n*/\nConverter.prototype.getUnit = function (abbr) {\n  var found;\n\n  each(measures, function (systems, measure) {\n    each(systems, function (units, system) {\n      if(system == '_anchors')\n        return false;\n\n      each(units, function (unit, testAbbr) {\n        if(testAbbr == abbr) {\n          found = {\n            abbr: abbr\n          , measure: measure\n          , system: system\n          , unit: unit\n          };\n          return false;\n        }\n      });\n\n      if(found)\n        return false;\n    });\n\n    if(found)\n      return false;\n  });\n\n  return found;\n};\n\nvar describe = function(resp) {\n  return {\n    abbr: resp.abbr\n  , measure: resp.measure\n  , system: resp.system\n  , singular: resp.unit.name.singular\n  , plural: resp.unit.name.plural\n  };\n}\n\n/**\n* An alias for getUnit\n*/\nConverter.prototype.describe = function (abbr) {\n  var resp = Converter.prototype.getUnit(abbr);\n  var desc = null;\n\n  try {\n    desc = describe(resp);\n  } catch(err) {\n    this.throwUnsupportedUnitError(abbr);\n  }\n\n  return desc;\n};\n\n/**\n* Detailed list of all supported units\n*/\nConverter.prototype.list = function (measure) {\n  var list = [];\n\n  each(measures, function (systems, testMeasure) {\n    if(measure && measure !== testMeasure)\n      return;\n\n    each(systems, function (units, system) {\n      if(system == '_anchors')\n        return false;\n\n      each(units, function (unit, abbr) {\n        list = list.concat(describe({\n          abbr: abbr,\n          measure: testMeasure\n        , system: system\n        , unit: unit\n        }));\n      });\n    });\n  });\n\n  return list;\n};\n\nConverter.prototype.throwUnsupportedUnitError = function (what) {\n  var validUnits = [];\n\n  each(measures, function (systems, measure) {\n    each(systems, function (units, system) {\n      if(system == '_anchors')\n        return false;\n\n      validUnits = validUnits.concat(keys(units));\n    });\n  });\n\n  throw new Error('Unsupported unit ' + what + ', use one of: ' + validUnits.join(', '));\n}\n\n/**\n* Returns the abbreviated measures that the value can be\n* converted to.\n*/\nConverter.prototype.possibilities = function (measure) {\n  var possibilities = [];\n  if(!this.origin && !measure) {\n\t  each(keys(measures), function (measure){\n\t\t  each(measures[measure], function (units, system) {\n\t\t    if(system == '_anchors')\n\t\t      return false;\n\n\t\t    possibilities = possibilities.concat(keys(units));\n\t\t  });\n\t  });\n  } else {\n\t  measure = measure || this.origin.measure;\n\t  each(measures[measure], function (units, system) {\n\t    if(system == '_anchors')\n\t      return false;\n\n\t    possibilities = possibilities.concat(keys(units));\n\t  });\n  }\n\n  return possibilities;\n};\n\n/**\n* Returns the abbreviated measures that the value can be\n* converted to.\n*/\nConverter.prototype.measures = function () {\n  return keys(measures);\n};\n\nconvert = function (value) {\n  return new Converter(value);\n};\n\nmodule.exports = convert;\n"]}