UNPKG

@fractorysolutions/safe-units

Version:
23 lines 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.divideExponents = exports.multiplyExponents = exports.addExponents = exports.negateExponent = exports.getExponentValue = void 0; function getExponentValue(value) { return parseInt(value, 10); } exports.getExponentValue = getExponentValue; var negateExponent = function (value) { return toExponent(-getExponentValue(value)); }; exports.negateExponent = negateExponent; exports.addExponents = wrapBinaryExponentFn(function (left, right) { return left + right; }); exports.multiplyExponents = wrapBinaryExponentFn(function (left, right) { return left * right; }); exports.divideExponents = wrapBinaryExponentFn(function (left, right) { return left / right; }); function wrapBinaryExponentFn(fn) { return function (left, right) { return toExponent(fn(getExponentValue(left), getExponentValue(right))); }; } function toExponent(value) { return "".concat(value); } //# sourceMappingURL=exponentValueArithmetic.js.map