How to use the isFunctionExpression function from babel-types
Find comprehensive JavaScript babel-types.isFunctionExpression code examples handpicked from public code repositorys.
91 92 93 94 95 96 97 98 99 100
babelTypes.isBlock(node) ) { return node.body.some(statement => hasBinding(statement, name)); } else if ( babelTypes.isFunctionDeclaration(node) || babelTypes.isFunctionExpression(node) || babelTypes.isArrowFunctionExpression(node) ) { return ( (node.id !== null && node.id.name === name) ||
0
49
1
+ 5 other calls in file
2 3 4 5 6 7 8 9 10 11
module.exports = parseNode; function parseNode(contextNode) { if ( t.isFunctionExpression(contextNode) || t.isArrowFunctionExpression(contextNode) || t.isFunctionDeclaration(contextNode) || t.isObjectMethod(contextNode) ) {
3
6
1
+ 7 other calls in file
58 59 60 61 62 63 64 65 66 67
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 ( (node.id !== null && node.id.name === name) || node.params.some( param => types.isIdentifier(param) && param.name === name
0
2
0
+ 3 other calls in file
GitHub: mrcoles/parcel
97 98 99 100 101 102 103 104 105 106
types.isBlock(node) ) { return node.body.some(statement => hasBinding(statement, name)); } else if ( types.isFunctionDeclaration(node) || types.isFunctionExpression(node) || types.isArrowFunctionExpression(node) ) { return ( (node.id !== null && node.id.name === name) ||
0
2
2
3 4 5 6 7 8 9 10 11 12
const isNodeTypeAFunction = n => t.isFunctionDeclaration(n) || t.isArrowFunctionExpression(n) || t.isClassMethod(n) || t.isFunctionExpression(n); // What to do with declareFunction type? const isPathTypeAFunction = p => p.isFunctionDeclaration() ||
2
60
3
140 141 142 143 144 145 146 147 148 149
const expr = statement.expression; const { left, right } = expr; if (t.isMemberExpression(left) && t.isThisExpression(left.object) && t.isIdentifier(left.property)) { if ((t.isArrowFunctionExpression(right) || t.isFunctionExpression(right)) || (left.property.name === 'config' && t.isObjectExpression(right))) { body.push(t.classProperty(left.property, right)); _.remove(method.body.body, statement); }
0
0
0
+ 6 other calls in file
799 800 801 802 803 804 805 806 807 808
t.isMemberExpression(left) && t.isThisExpression(left.object) && t.isIdentifier(left.property) ) { if ( (t.isArrowFunctionExpression(right) || t.isFunctionExpression(right)) || (left.property.name === 'config' && t.isObjectExpression(right)) ) { body.push( t.classProperty(left.property, right)
0
0
0
babel-types.identifier is the most popular function in babel-types (4076 examples)