Files
KaTeX/src/parseTree.js
2017-01-13 22:37:17 -05:00

21 lines
537 B
JavaScript

/**
* Provides a single function for parsing an expression using a Parser
* TODO(emily): Remove this
*/
const Parser = require("./Parser");
/**
* Parses an expression using a Parser, then returns the parsed result.
*/
const parseTree = function(toParse, settings) {
if (!(typeof toParse === 'string' || toParse instanceof String)) {
throw new TypeError('KaTeX can only parse string typed expression');
}
const parser = new Parser(toParse, settings);
return parser.parse();
};
module.exports = parseTree;