diff --git a/ignore_dictionary.txt b/ignore_dictionary.txt index 3807708..401bc56 100644 --- a/ignore_dictionary.txt +++ b/ignore_dictionary.txt @@ -101,3 +101,10 @@ шаблонизатора шаблонизатором Юникода +веб-инспекторе +веб-инспектор +крестиков-ноликов +крестики-нолики +деструктуризация +деструктуризацию +деструктуризации diff --git a/src/index.js b/src/index.js index f4386e1..0605ec1 100644 --- a/src/index.js +++ b/src/index.js @@ -21,10 +21,10 @@ const filterBlocks = [ ]; const filterWordsContent = fs.readFileSync('ignore_dictionary.txt', 'utf-8'); -const filterWords = filterWordsContent.split(/\n/); +const filterWords = filterWordsContent.split(/\n/).map((word) => word.toLowerCase()); const isFiltered = (word) => { - if (filterWords.includes(word)) { + if (filterWords.includes(word.toLowerCase())) { return true; } @@ -140,9 +140,13 @@ const checkTree = (source, rules) => { return tree; } - const newValue = await checkContent(tree.value, rules); + try { + const newValue = await checkContent(tree.value, rules); - tree.value = newValue; + tree.value = newValue; + } catch(e) { + console.error(tree.value); + } if (tree.children) { tree.children = await Promise.all(tree.children.map(iter));