summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2017-03-13 11:59:08 -0400
committerAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2017-03-13 11:59:08 -0400
commitbeb283891dfa27040296382d98ede4b1623ae176 (patch)
tree657907388873b1d5172133f586bf8fb9e09b42c6
parent0e0ce0c7a501ea918ad8d243c9666a2b64df30b3 (diff)
downloaduoft-artsci-exam-filter-beb283891dfa27040296382d98ede4b1623ae176.tar.xz
uoft-artsci-exam-filter-beb283891dfa27040296382d98ede4b1623ae176.zip
Improve fuzzy matching.
-rw-r--r--uoft-artsci-exam-filter.user.js16
1 files 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;
};