docs:更新文档

This commit is contained in:
张益铭
2021-03-01 15:06:11 +08:00
parent 1542135ab0
commit 9064b372e8
5835 changed files with 904126 additions and 161722 deletions

39
node_modules/estree-walker/src/walker.ts generated vendored Normal file
View File

@@ -0,0 +1,39 @@
import { BaseNode } from "estree";
export type WalkerContext = {
skip: () => void;
remove: () => void;
replace: (node: BaseNode) => void;
};
export class WalkerBase {
protected should_skip: boolean = false;
protected should_remove: boolean = false;
protected replacement: BaseNode = null;
public context: WalkerContext = {
skip: () => (this.should_skip = true),
remove: () => (this.should_remove = true),
replace: (node: BaseNode) => (this.replacement = node)
};
public replace(parent: any, prop: string, index: number, node: BaseNode) {
if (parent) {
if (index !== null) {
parent[prop][index] = node;
} else {
parent[prop] = node;
}
}
}
public remove(parent: any, prop: string, index: number) {
if (parent) {
if (index !== null) {
parent[prop].splice(index, 1);
} else {
delete parent[prop];
}
}
}
}