ASTUtil
Utility for AST.
Static Method Summary
Static Public Methods | ||
public static |
createVariableDeclarationAndNewExpressionNode(name: string, className: string, loc: Object): ASTNode create VariableDeclaration node which has NewExpression. |
|
public static |
find ClassDeclaration node. |
|
public static |
findFunctionDeclarationNode(name: string, ast: AST): ASTNode | null find FunctionDeclaration node. |
|
public static |
findPathInImportDeclaration(ast: AST, name: string): string | null find file path in import declaration by name. |
|
public static |
findVariableDeclarationAndNewExpressionNode(name: string, ast: AST): ASTNode | null find VariableDeclaration node which has NewExpression. |
|
public static |
findVariableDeclarationNode(name: string, ast: AST): ASTNode | null find VariableDeclaration node. |
|
public static |
sanitize node. |
|
public static |
traverse ast nodes. |
Static Public Methods
public static createVariableDeclarationAndNewExpressionNode(name: string, className: string, loc: Object): ASTNode source
create VariableDeclaration node which has NewExpression.
public static findClassDeclarationNode(name: string, ast: AST): {classNode: ASTNode|null, exported: boolean|null} source
find ClassDeclaration node.
public static findFunctionDeclarationNode(name: string, ast: AST): ASTNode | null source
find FunctionDeclaration node.
public static findPathInImportDeclaration(ast: AST, name: string): string | null source
find file path in import declaration by name.
e.g. can find ./foo/bar.js
from import Bar from './foo/bar.js'
by Bar
.
public static findVariableDeclarationAndNewExpressionNode(name: string, ast: AST): ASTNode | null source
find VariableDeclaration node which has NewExpression.
public static findVariableDeclarationNode(name: string, ast: AST): ASTNode | null source
find VariableDeclaration node.