UNPKG

conversion

Version:

a javascript library for unit conversions and organizations

24 lines (19 loc) 588 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var getUnit = function getUnit(units) { return function (symbol) { var unit = units[symbol]; if (typeof unit === 'undefined') { var possibleUnits = Object.keys(units).join(','); var errorMessage = "".concat(symbol, "' is not a unit"); var hint = "possible units: [".concat(possibleUnits, "]"); throw new Error("'".concat(errorMessage, ", ").concat(hint)); } return unit; }; }; var _default = getUnit; exports["default"] = _default;