How to use the isStatement function from @babel/types
Find comprehensive JavaScript @babel/types.isStatement code examples handpicked from public code repositorys.
GitHub: suchipi/tofu
181 182 183 184 185 186 187 188 189 190
export const wrappingStatement = ( wrapper: (child?) => any, getInitialCursor: (ast, path: string[]) => Cursor ) => ({ ast, cursor: [start] }: { ast: any; cursor: Cursor }) => { const [parents, path] = getFocusPath(ast, start); const parentStatementIndex = findLastIndex(parents, n => t.isStatement(n)); const parentStatement = parents[parentStatementIndex]; let basePath; if (parentStatement && !t.isBlockStatement(parentStatement)) {
4
0
1
+ 5 other calls in file
142 143 144 145 146 147 148 149 150 151
replacement = t.expressionStatement(replacement); nodePath = "expression"; } } if (this.isNodeType("Expression") && t.isStatement(replacement)) { if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) { return this.replaceExpressionWithStatements([replacement]); } }
0
0
0
@babel/types.identifier is the most popular function in @babel/types (20936 examples)