Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
27
Frontend-Learner/node_modules/eslint-plugin-import-x/lib/utils/visit.js
generated
vendored
Normal file
27
Frontend-Learner/node_modules/eslint-plugin-import-x/lib/utils/visit.js
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
export function visit(node, keys, visitorSpec) {
|
||||
if (!node || !keys) {
|
||||
return;
|
||||
}
|
||||
const type = node.type;
|
||||
const visitor = visitorSpec[type];
|
||||
if (typeof visitor === 'function') {
|
||||
visitor(node);
|
||||
}
|
||||
const childFields = keys[type];
|
||||
if (!childFields) {
|
||||
return;
|
||||
}
|
||||
for (const fieldName of childFields) {
|
||||
for (const item of [node[fieldName]].flat()) {
|
||||
if (!item || typeof item !== 'object' || !('type' in item)) {
|
||||
continue;
|
||||
}
|
||||
visit(item, keys, visitorSpec);
|
||||
}
|
||||
}
|
||||
const exit = visitorSpec[`${type}:Exit`];
|
||||
if (typeof exit === 'function') {
|
||||
exit(node);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=visit.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue