summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
};