From beb283891dfa27040296382d98ede4b1623ae176 Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Mon, 13 Mar 2017 11:59:08 -0400 Subject: Improve fuzzy matching. --- uoft-artsci-exam-filter.user.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/uoft-artsci-exam-filter.user.js b/uoft-artsci-exam-filter.user.js index 2535f8a..62b5880 100644 --- a/uoft-artsci-exam-filter.user.js +++ b/uoft-artsci-exam-filter.user.js @@ -40,14 +40,14 @@ if (!storage) var parseCourses = function (mycoursesstr) { var mycourses = {names: [], sections: []}; - mycoursesstr.split(/[ ,;]/).forEach(function (c) { - // merge multiple delimiters - if (!c) - return; - var cspl = c.split(/[\/:]/); - if (cspl[1]) - mycourses.sections[mycourses.names.length] = cspl[1].toUpperCase(); - mycourses.names.push(cspl[0].toUpperCase()); + mycoursesstr.split(/[ ,;]+/).forEach(function (c) { + // ignore empty courses + if (c) { + var cspl = c.split(/[\/:]+/); + if (cspl[1]) + mycourses.sections[mycourses.names.length] = cspl[1].toUpperCase(); + mycourses.names.push(cspl[0].toUpperCase()); + } }); return mycourses; }; -- cgit v1.2.3-54-g00ecf