Skip to content

Commit

Permalink
(fix) do not blow up if Requires: is blank
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Mar 19, 2023
1 parent 5aa8d37 commit 3691543
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/lib/language.js
Expand Up @@ -56,7 +56,12 @@ class Language {
const categoryMatch = CATEGORY_REGEX.exec(this.data);
const languageMatch = LANGUAGE_REGEX.exec(this.data);

if (requiresMatch) { this.requires = requiresMatch[1].split(", ").map((n) => n.replace(".js", "")); }
if (requiresMatch) {
this.requires = requiresMatch[1]
.split(", ")
.map((n) => n.replace(".js", ""))
.filter(n => n.trim() !== "");
}

if (categoryMatch) { this.categories = categoryMatch[1].split(/,\s?/); }

Expand Down

0 comments on commit 3691543

Please sign in to comment.