Change how options parsing works

This commit is contained in:
1computer1 2019-03-13 01:08:03 -04:00
parent db79b4b026
commit 318a485bfb
2 changed files with 8 additions and 4 deletions

View file

@ -6,7 +6,7 @@ class JavaScript extends Language {
highlight: 'js',
aliases: ['javaScript', 'js'],
options: {
harmony: () => true
harmony: () => ''
}
});
}

View file

@ -76,9 +76,13 @@ class MessageInvalidListener extends Listener {
continue;
}
const ok = Object.prototype.hasOwnProperty.call(language.options, key) && language.options[key](value);
if (ok) {
valid.set(key, value);
if (Object.prototype.hasOwnProperty.call(language.options, key)) {
const parse = language.options[key](value);
if (parse != null) {
valid.set(key, parse);
} else {
invalid.push(key);
}
} else {
invalid.push(key);
}