How to use the isProgram function from babel-types
Find comprehensive JavaScript babel-types.isProgram code examples handpicked from public code repositorys.
195 196 197 198 199 200 201 202 203 204
path.scope.rename(path.node.id.name, file.property + '_local_fn_' + path.node.id.name); return; } // rename all top level variables to keep them local to the module if (t.isVariableDeclaration(path.node) && t.isProgram(path.parent)) { path.node.declarations.forEach(function (declaration) { path.scope.rename( declaration.id.name, file.property + '_local_var_' + declaration.id.name
59
89
10
+ 51 other calls in file
199 200 201 202 203 204 205 206 207 208
} // rename all top level variables to keep them local to the module if ( t.isVariableDeclaration(path.node) && t.isProgram(path.parent) ) { path.node.declarations.forEach(function (declaration) { path.scope.rename( declaration.id.name,
20
50
8
84 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));
0
49
0
+ 3 other calls in file
GitHub: mrcoles/parcel
90 91 92 93 94 95 96 97 98 99
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));
0
2
2
babel-types.identifier is the most popular function in babel-types (4076 examples)