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', highlight: 'js',
aliases: ['javaScript', 'js'], aliases: ['javaScript', 'js'],
options: { options: {
harmony: () => true harmony: () => ''
} }
}); });
} }

View file

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