UNPKG

@qtikit/mathml-to-latex

Version:

A JavaScript tool to convert mathml string to LaTeX string

36 lines (35 loc) 1.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MO = void 0; var helpers_1 = require("../../../helpers"); var syntax_1 = require("../../../../syntax"); var MO = /** @class */ (function () { function MO(mathElement) { this._mathmlElement = mathElement; } MO.prototype.convert = function () { var normalizedValue = (0, helpers_1.normalizeWhiteSpaces)(this._mathmlElement.value); var trimmedValue = normalizedValue.trim(); return Operator.operate(trimmedValue); }; return MO; }()); exports.MO = MO; var Operator = /** @class */ (function () { function Operator(value) { this._value = value; } Operator.operate = function (value) { return new Operator(value)._operate(); }; Operator.prototype._operate = function () { return this._findByCharacter() || this._findByGlyph() || this._value; }; Operator.prototype._findByCharacter = function () { return syntax_1.allMathOperatorsByChar[this._value]; }; Operator.prototype._findByGlyph = function () { return syntax_1.allMathOperatorsByGlyph[this._value]; }; return Operator; }());