From 318a485bfbf29f887d565817cb7af7103c796d5d Mon Sep 17 00:00:00 2001 From: 1computer1 Date: Wed, 13 Mar 2019 01:08:03 -0400 Subject: [PATCH] Change how options parsing works --- src/languages/javascript.js | 2 +- src/listeners/messageInvalid.js | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/languages/javascript.js b/src/languages/javascript.js index 18e8f75..16aa887 100644 --- a/src/languages/javascript.js +++ b/src/languages/javascript.js @@ -6,7 +6,7 @@ class JavaScript extends Language { highlight: 'js', aliases: ['javaScript', 'js'], options: { - harmony: () => true + harmony: () => '' } }); } diff --git a/src/listeners/messageInvalid.js b/src/listeners/messageInvalid.js index cb830f5..306c6bd 100644 --- a/src/listeners/messageInvalid.js +++ b/src/listeners/messageInvalid.js @@ -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); }