Skip to content

Commit

Permalink
fix: update filter function (#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
navateja-alagam authored Feb 12, 2024
1 parent 987dfd0 commit 66e5cb2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/format/src/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ export function exceptionListFilterSelectorKeywords(
}

function checkSelectorFilterKeyWordsExists(node: axe.NodeResult, selectorFilterKeywords: string[]): boolean {
const selectorAncestry = node.ancestry?.flat(Infinity) ?? [];
const selectorAncestry = (node.ancestry?.flat(Infinity) ?? []) as string[];
let isExists = false;
selectorFilterKeywords.some((keyword) => {
isExists = selectorAncestry.some((selector) => selector.includes(keyword));
isExists = selectorAncestry.some((selector) => {
const lastSelector = selector.split('>').pop();
return lastSelector?.includes(keyword) ?? false;
});
return isExists;
});
return isExists;
Expand Down

0 comments on commit 66e5cb2

Please sign in to comment.