www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

parseTree.js (537B)


      1 /**
      2  * Provides a single function for parsing an expression using a Parser
      3  * TODO(emily): Remove this
      4  */
      5 
      6 const Parser = require("./Parser");
      7 
      8 /**
      9  * Parses an expression using a Parser, then returns the parsed result.
     10  */
     11 const parseTree = function(toParse, settings) {
     12     if (!(typeof toParse === 'string' || toParse instanceof String)) {
     13         throw new TypeError('KaTeX can only parse string typed expression');
     14     }
     15     const parser = new Parser(toParse, settings);
     16 
     17     return parser.parse();
     18 };
     19 
     20 module.exports = parseTree;