How to use the isFunction function from @babel/types
Find comprehensive JavaScript @babel/types.isFunction code examples handpicked from public code repositorys.
121 122 123 124 125 126 127 128 129 130
} if (name in propertyHandlers) { propertyHandlers[name](prop.value); } else if ( (babel.isMethod(prop) && prop.kind === 'method') || babel.isFunction(prop.value)) { const method = esutil.toScannedMethod( prop, this.document.sourceRangeForNode(prop), this.document); element.addMethod(method); }
12
0
0
GitHub: omarjuice/algo-viz
148 149 150 151 152 153 154 155 156 157
}, ReturnStatement: { exit(path) { // for call stack management const parent = path.findParent(parent => t.isFunction(parent)) if (!path.node.argument) { path.node.argument = t.identifier('undefined') } path.node.argument = proxy(path.node.argument, {
5
27
1
+ 21 other calls in file
19 20 21 22 23 24 25 26 27 28
comment.kind = 'class'; if (node.abstract) { comment.abstract = true; } } else if ( t.isFunction(node) || t.isTSDeclareMethod(node) || t.isTSDeclareFunction(node) || t.isFunctionTypeAnnotation(node) || t.isTSMethodSignature(node)
509
0
0
+ 20 other calls in file
97 98 99 100 101 102 103 104 105 106
return comment; } function getReturnType(fn) { if ( t.isFunction(fn) || t.isTSDeclareFunction(fn) || t.isTSDeclareMethod(fn) || t.isFunctionTypeAnnotation(fn) ) {
509
0
0
+ 3 other calls in file
211 212 213 214 215 216 217 218 219 220
t.isNewExpression(argumentPath.node) || t.isIdentifier(argumentPath.node))) || t.isMemberExpression(argumentPath.node) || t.isLiteral(argumentPath.node) || t.isObjectExpression(argumentPath.node) || t.isFunction(argumentPath.node) || t.isClass(argumentPath.node) ) { return; }
0
3
3
+ 28 other calls in file
96 97 98 99 100 101 102 103 104 105
return ONE_LINE; if (isIf(path)) return ONE_LINE; if (path.parentPath.isCallExpression() && isFunction(path.parentPath.node.arguments[1])) return ONE_LINE; if (isCoupleLines(path)) return MANY_LINES;
0
1
0
+ 5 other calls in file
65 66 67 68 69 70 71 72 73 74
after: !node.consequent.length && parent.cases[parent.cases.length - 1] === node }; }, LogicalExpression(node) { if (t.isFunction(node.left) || t.isFunction(node.right)) { return { after: true }; }
0
0
0
@babel/types.identifier is the most popular function in @babel/types (20936 examples)