Skip to content

Commit

Permalink
fix tests and traverser
Browse files Browse the repository at this point in the history
  • Loading branch information
yeonjuan committed Nov 18, 2024
1 parent f41b47e commit 69ad912
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 354 deletions.
12 changes: 5 additions & 7 deletions packages/template-parser/lib/traverser.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,14 @@ const visitorKeys = {
function traverse(node, visitors) {
const visitor = visitors[node.type];
visitor && visitor(node);
const nextKeys = node[visitorKeys[node.type]];
if (!Array.isArray(nextKeys) || nextKeys.length === 0) {
return;
}
const nextKeys = visitorKeys[node.type];

nextKeys.forEach((key) => {
const next = node[key];
if (Array.isArray(next)) {
next.forEach((n) => traverse(n, visitor));
} else {
traverse(next, visitor);
next.forEach((n) => traverse(n, visitors));
} else if (next) {
traverse(next, visitors);
}
});
}
Expand Down

This file was deleted.

Loading

0 comments on commit 69ad912

Please sign in to comment.