How to use the isCallExpression function from babel-types
Find comprehensive JavaScript babel-types.isCallExpression code examples handpicked from public code repositorys.
GitHub: ygmpkk/anu
26 27 28 29 30 31 32 33 34 35
if (t.isConditionalExpression(expr) || t.isIfStatement(expr)) { return condition(expr.test, expr.consequent, expr.alternate, modules); } else if (t.isLogicalExpression(expr) && expr.operator === '&&') { return condition(expr.left, expr.right, null, modules); } else if ( t.isCallExpression(expr) && expr.callee.property.name === 'map' ) { // 处理列表指令 if (expr.arguments[0].type === 'ArrowFunctionExpression') {
330
0
1
+ 13 other calls in file
92 93 94 95 96 97 98 99 100 101
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')); if (isValid) { // prop
64
411
8
40 41 42 43 44 45 46 47 48 49
t.isIdentifier(node.property, { name: 'exports' }) ); } function isRequire(node, filename) { if ( t.isCallExpression(node) && t.isIdentifier(node.callee, { name: 'require' }) && node.arguments.length === 1 && t.isStringLiteral(node.arguments[0]) ) {
59
89
10
+ 25 other calls in file
GitHub: pugjs/then-pug
109 110 111 112 113 114 115 116 117 118
} Compiler.prototype.ast_postprocess = function(ast) { let needCompaction = function(c) { return t.isExpressionStatement(c) && t.isCallExpression(c.expression) && t.isMemberExpression(c.expression.callee) && t.isIdentifier(c.expression.callee.object) && c.expression.callee.object.name === 'buf' && t.isIdentifier(c.expression.callee.property)
5
43
10
+ 7 other calls in file
198 199 200 201 202 203 204 205 206 207
const url = types.identifier('url') const routeName = nameInfo.value.value let expressions, quasis if (paramsItems.some(item => types.isCallExpression(item.value) || types.isMemberExpression(item.value))) { const expressionList = paramsItems.filter(item => types.isCallExpression(item.value) || types.isMemberExpression(item.value)) const literalList = paramsItems.filter(item => types.isLiteral(item.value)) const templateElementLastItem = literalList.reduce((finalString, cur) => { return `${finalString}&${cur.key.name}=${cur.value.value}`
4
12
2
+ 39 other calls in file
32 33 34 35 36 37 38 39 40 41
// delete super(props) and prepend later traverse(p.node, { enter: function enter(p) { if (t.isExpressionStatement(p.node) && t.isCallExpression(p.node.expression) && t.isSuper(p.node.expression.callee)) { p.remove(); } }
1
11
1
+ 5 other calls in file
32 33 34 35 36 37 38 39 40 41
// delete super(props) and prepend later traverse(p.node, { enter (p) { if (t.isExpressionStatement(p.node) && t.isCallExpression(p.node.expression) && t.isSuper(p.node.expression.callee)) { p.remove();
1
11
1
+ 3 other calls in file
90 91 92 93 94 95 96 97 98 99
if (identifierName === 'module' && !path.scope.hasBinding('module')) { const parentPath = path.parentPath; const parentNode = path.parentPath.node; if (t.isMemberExpression(parentNode) && parentNode.object === path.node) { const name = parentNode.computed ? parentNode.property.value : parentNode.property.name; if (name === 'require' && t.isCallExpression(parentPath.parent) && parentPath.parent.callee === parentPath.node) addDependency(parentPath.parent.arguments[0], state); } } }
2
3
3
GitHub: astrocean/taro-cli-2.0.6
719 720 721 722 723 724 725 726 727 728
Program: { exit(astPath) { const node = astPath.node; node.body.forEach((bodyNode) => { if (t.isExpressionStatement(bodyNode) && t.isCallExpression(bodyNode.expression) && t.isIdentifier(bodyNode.expression.callee) && bodyNode.expression.callee.name === 'mountApis') { const mountApisOptNode = bodyNode.expression.arguments[0]; if (t.isObjectExpression(mountApisOptNode)) {
0
0
0
+ 11 other calls in file
babel-types.identifier is the most popular function in babel-types (4076 examples)