How to use the isClassDeclaration function from @babel/types
Find comprehensive JavaScript @babel/types.isClassDeclaration code examples handpicked from public code repositorys.
GitHub: omarjuice/algo-viz
86 87 88 89 90 91 92 93 94 95
} else if (t.isIdentifier(path.parent.callee)) { const idx = path.parent.arguments.indexOf(path.node) funcName = path.parent.callee.name + '(callback-' + idx + ')' } } else if (t.isClassMethod(path.node)) { const parent = path.findParent(p => t.isClassDeclaration(p) || t.isClassExpression(p)) if (t.isIdentifier(parent.node.id)) { if (t.isIdentifier(path.node.key)) { funcName = parent.node.id.name + '.' + path.node.key.name
5
27
1
+ 21 other calls in file
GitHub: codemix/documentation
22 23 24 25 26 27 28 29 30 31
} // If this is an ES6 class with a constructor method, infer // parameters from that constructor method. if ( t.isClassDeclaration(path) && !(comment.constructorComment && comment.constructorComment.hideconstructor) ) { const constructor = path.node.body.body.find(item => { // https://github.com/babel/babylon/blob/master/ast/spec.md#classbody
510
0
5
+ 7 other calls in file
144 145 146 147 148 149 150 151 152 153
if (t.isIdentifier(declaration)) { local = declaration.name; } else if ( t.isFunctionDeclaration(declaration) || t.isClassDeclaration(declaration) ) { if (declaration.id) { local = declaration.id.name; } else {
6
34
3
+ 19 other calls in file
GitHub: arthuredelstein/hakk
586 587 588 589 590 591 592 593 594 595
outputASTs.push(resultsAST); } } } if (types.isFunctionDeclaration(declaration) || types.isClassDeclaration(declaration)) { const identifier = declaration.id; const resultsAST = astCodeToAddToModuleExports(identifier, identifier.name); copyLocation(declaration, resultsAST); outputASTs.push(resultsAST);
0
0
0
+ 21 other calls in file
@babel/types.identifier is the most popular function in @babel/types (20936 examples)