UNPKG

az-mathml-to-latex

Version:

A JavaScript tool to convert mathml string to LaTeX string

22 lines (21 loc) 951 B
"use strict"; 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 = helpers_1.mathMLElementToLaTeXConverter(children[0]).convert(); var exponent = helpers_1.mathMLElementToLaTeXConverter(children[1]).convert(); return new helpers_1.ParenthesisWrapper().wrapIfMoreThanOneChar(base) + "^" + new helpers_1.BracketWrapper().wrap(exponent); }; return MSup; }()); exports.MSup = MSup;