From 3ec81c5707fe7399d39c7bd0c318f0ff4b86a7a9 Mon Sep 17 00:00:00 2001 From: mbilker Date: Wed, 27 Jan 2016 11:04:56 -0500 Subject: [PATCH 1/3] fix(spellchecker): broken array check logic for en_US default --- src/nylas-spellchecker.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nylas-spellchecker.coffee b/src/nylas-spellchecker.coffee index 59f410373..16caf35f9 100644 --- a/src/nylas-spellchecker.coffee +++ b/src/nylas-spellchecker.coffee @@ -76,7 +76,7 @@ class NylasSpellchecker getAvailableDictionaries: -> if process.platform is 'linux' arr = spellchecker.getAvailableDictionaries() - if not "en_US" in arr + if "en_US" not in arr arr.push('en_US') # Installed by default in node-spellchecker's vendor directory arr else From 8efb711bfe1a96dcf41e63b6b3d7c4a25aa1e5da Mon Sep 17 00:00:00 2001 From: mbilker Date: Wed, 27 Jan 2016 11:47:17 -0500 Subject: [PATCH 2/3] fix(spellchecker): check both replacements of '_' and '-' in dictionary array --- src/nylas-spellchecker.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nylas-spellchecker.coffee b/src/nylas-spellchecker.coffee index 16caf35f9..30736cf46 100644 --- a/src/nylas-spellchecker.coffee +++ b/src/nylas-spellchecker.coffee @@ -12,7 +12,7 @@ class NylasSpellchecker isLanguageAvailable: (lang) => return false unless lang dicts = @getAvailableDictionaries() - return (lang in dicts) or (lang.split(/[-_]/)[0] in dicts) + return (lang in dicts) or (lang.replace('_', '-') in dicts) or (lang.replace('-', '_') in dicts) isSpelledCorrectly: (args...) => not @isMisspelled(args...) From fab11f649ded2ca7446213f77edbb0864210a91b Mon Sep 17 00:00:00 2001 From: mbilker Date: Wed, 27 Jan 2016 15:49:37 -0500 Subject: [PATCH 3/3] fix(spellchecker): add back in split call Fixes the spec test when only the language (e.g. 'en') is supplied and still recognize the language. --- src/nylas-spellchecker.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nylas-spellchecker.coffee b/src/nylas-spellchecker.coffee index 30736cf46..cf4f06fa0 100644 --- a/src/nylas-spellchecker.coffee +++ b/src/nylas-spellchecker.coffee @@ -12,7 +12,7 @@ class NylasSpellchecker isLanguageAvailable: (lang) => return false unless lang dicts = @getAvailableDictionaries() - return (lang in dicts) or (lang.replace('_', '-') in dicts) or (lang.replace('-', '_') in dicts) + return (lang in dicts) or (lang.split(/[-_]/)[0] in dicts) or (lang.replace('_', '-') in dicts) or (lang.replace('-', '_') in dicts) isSpelledCorrectly: (args...) => not @isMisspelled(args...)