mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-11 22:18:41 +00:00
Remove dependency on underscore
Summary: Remove all uses of underscore. For the things we actually need, make a "util" file and put them in there. Test Plan: Make sure the test still succeed, and that the main page still works. Reviewers: alpert Reviewed By: alpert Differential Revision: http://phabricator.khanacademy.org/D3043
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
var Lexer = require("./Lexer");
|
||||
var utils = require("./utils");
|
||||
|
||||
// Main Parser class
|
||||
function Parser() {
|
||||
@@ -164,10 +165,6 @@ Parser.prototype.parseGroup = function(pos) {
|
||||
}
|
||||
};
|
||||
|
||||
// Tests whether an element is in a list
|
||||
function contains(list, elem) {
|
||||
return list.indexOf(elem) !== -1;
|
||||
}
|
||||
|
||||
// A list of 1-argument color functions
|
||||
var colorFuncs = [
|
||||
@@ -211,7 +208,7 @@ for (var type in copyFuncs) {
|
||||
Parser.prototype.parseNucleus = function(pos) {
|
||||
var nucleus = this.lexer.lex(pos);
|
||||
|
||||
if (contains(colorFuncs, nucleus.type)) {
|
||||
if (utils.contains(colorFuncs, nucleus.type)) {
|
||||
// If this is a color function, parse its argument and return
|
||||
var group = this.parseGroup(nucleus.position);
|
||||
if (group) {
|
||||
|
Reference in New Issue
Block a user