Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dzencot committed Apr 21, 2024
1 parent f2ab7a0 commit a0438e1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 7 additions & 0 deletions ignore_dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,10 @@
шаблонизатора
шаблонизатором
Юникода
веб-инспекторе
веб-инспектор
крестиков-ноликов
крестики-нолики
деструктуризация
деструктуризацию
деструктуризации
12 changes: 8 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit a0438e1

Please sign in to comment.