How to use the isBlockStatement function from babel-types
Find comprehensive JavaScript babel-types.isBlockStatement code examples handpicked from public code repositorys.
85 86 87 88 89 90 91 92 93 94
function hasBinding(node, name) { if (Array.isArray(node)) { return node.some(ancestor => hasBinding(ancestor, name)); } else if ( babelTypes.isProgram(node) || babelTypes.isBlockStatement(node) || babelTypes.isBlock(node) ) { return node.body.some(statement => hasBinding(statement, name)); } else if (
0
49
1
+ 5 other calls in file
GitHub: framework-design/anu
79 80 81 82 83 84 85 86 87 88
// 过一段时间再加回来 // attrs.push(createAttribute('tid', utils.genKey(modules.key))); modules.key = null; } const body = t.isBlockStatement(fn.body) ? fn.body.body.find(t.isReturnStatement) : fn.body; if (body) {
330
0
2
+ 7 other calls in file
90 91 92 93 94 95 96 97 98
path.traverse({ ThisExpression (thisPath) { const parentNode = thisPath.parentPath.parentPath.parent; const isValid = t.isExpressionStatement(parentNode) || t.isVariableDeclaration(parentNode) || t.isBlockStatement(parentNode) || t.isJSXElement(parentNode) || t.isCallExpression(parentNode) || (t.isJSXAttribute(parentNode) && !parentNode.name.name.startsWith('on'));
64
411
8
GitHub: Philmod/parcel
93 94 95 96 97 98 99 100 101 102
function hasBinding(node, name) { if (Array.isArray(node)) { return node.some(ancestor => hasBinding(ancestor, name)); } else if ( types.isProgram(node) || types.isBlockStatement(node) || types.isBlock(node) ) { return node.body.some(statement => hasBinding(statement, name)); } else if (
0
1
2
55 56 57 58 59 60 61 62 63 64 65
function hasBinding(node, name) { if (Array.isArray(node)) { return node.some(ancestor => hasBinding(ancestor, name)); } else if (types.isProgram(node) || types.isBlockStatement(node) || types.isBlock(node)) { return node.body.some(statement => hasBinding(statement, name)); } else if (types.isFunctionDeclaration(node) || types.isFunctionExpression(node) || types.isArrowFunctionExpression(node)) { return (
0
2
0
+ 3 other calls in file
babel-types.identifier is the most popular function in babel-types (4076 examples)