@qtikit/mathml-to-latex
Version:
A JavaScript tool to convert mathml string to LaTeX string
22 lines (21 loc) • 910 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MRoot = void 0;
var helpers_1 = require("../../../helpers");
var errors_1 = require("../../../errors");
var MRoot = /** @class */ (function () {
function MRoot(mathElement) {
this._mathmlElement = mathElement;
}
MRoot.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 content = (0, helpers_1.mathMLElementToLaTeXConverter)(children[0]).convert();
var rootIndex = (0, helpers_1.mathMLElementToLaTeXConverter)(children[1]).convert();
return "\\sqrt[".concat(rootIndex, "]{").concat(content, "}");
};
return MRoot;
}());
exports.MRoot = MRoot;