How to use the isExpression function from @babel/types
Find comprehensive JavaScript @babel/types.isExpression code examples handpicked from public code repositorys.
GitHub: suchipi/tofu
![suchipi profile picture](/suchipi.png?size=40)
158 159 160 161 162 163 164 165 166 167
return; } { const isExpressionOrBlock = t.isExpression(node) && !t.isStringLiteral(node) && !t.isTemplateLiteral(node); if (isExpressionOrBlock && ['(', '[', '{'].includes(key)) {
+ 3 other calls in file
GitHub: suchipi/tofu
![suchipi profile picture](/suchipi.png?size=40)
59 60 61 62 63 64 65 66 67 68
return isRight ? nextStart : start; } if ( t.isExpression(node) && t.isExpression(getNode(ast, nextStart)) && !t.isArrowFunctionExpression(node) ) { if ( (code[nextStart] == '(' && recursionDepth === 0) ||
+ 27 other calls in file
68 69 70 71 72 73 74 75 76 77 78 79
} if (this.isExpression()) { return t.isBlockStatement(replacement); } else if (this.isBlockStatement()) { return t.isExpression(replacement); } return false; }
88 89 90 91 92 93 94 95 96 97 98 99
checkPath(path) { if (path.isIdentifier()) { return path.isReferencedIdentifier(); } else { return t.isExpression(path.node); } } };
GitHub: OsmePhe/zeeat
96 97 98 99 100 101 102 103 104 105
parentPath } = this; if (parentPath.isExpressionStatement() || parentPath.isLabeledStatement() || parentPath.isExportNamedDeclaration() || parentPath.isExportDefaultDeclaration() && this.isDeclaration()) { return parentPath.insertAfter(nodes.map(node => { return t.isExpression(node) ? t.expressionStatement(node) : node; })); } else if (this.isNodeType("Expression") && !this.isJSXElement() && !parentPath.isJSXElement() || parentPath.isForStatement() && this.key === "init") { if (this.node) { let {
135 136 137 138 139 140 141 142 143 144
throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`"); } let nodePath = ""; if (this.isNodeType("Statement") && t.isExpression(replacement)) { if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement) && !this.parentPath.isExportDefaultDeclaration()) { replacement = t.expressionStatement(replacement); nodePath = "expression"; }
@babel/types.identifier is the most popular function in @babel/types (20936 examples)