@qtikit/mathml-to-latex
Version:
A JavaScript tool to convert mathml string to LaTeX string
22 lines (21 loc) • 919 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MSup = void 0;
var helpers_1 = require("../../../helpers");
var errors_1 = require("../../../errors");
var MSup = /** @class */ (function () {
function MSup(mathElement) {
this._mathmlElement = mathElement;
}
MSup.prototype.convert = function () {
var _a = this._mathmlElement, name = _a.name, children = _a.children;
var childrenLength = children.length;
if (childrenLength !== 2)
throw new errors_1.InvalidNumberOfChildrenError(name, 2, childrenLength);
var base = (0, helpers_1.mathMLElementToLaTeXConverter)(children[0]).convert();
var exponent = (0, helpers_1.mathMLElementToLaTeXConverter)(children[1]).convert();
return "".concat(base, "^").concat(new helpers_1.BracketWrapper().wrap(exponent));
};
return MSup;
}());
exports.MSup = MSup;