Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
fix: if the nodeName object not know it could cause error
Browse files Browse the repository at this point in the history
  • Loading branch information
AnakinSkywalkeer committed Sep 24, 2023
1 parent 80b0641 commit 4b1a374
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/helpers/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const traverse = (result: Record<string, string[]>, node: Node, itemsToExclude:

result[node.nodeName].push(node.value?.trim() ?? "");

if (node.childNodes && node.childNodes.length > 0) {
if (node.childNodes && node.childNodes.length > 0 && !itemsToExclude.includes(node.nodeName)) {
node.childNodes.forEach((child) => traverse(result, child, itemsToExclude));
}

Expand Down

0 comments on commit 4b1a374

Please sign in to comment.