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
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)) {
4
0
1
+ 3 other calls in file
GitHub: suchipi/tofu
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) ||
4
0
1
+ 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; }
1
0
0
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); } } };
0
0
0
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 {
0
0
0
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"; }
0
0
0
@babel/types.identifier is the most popular function in @babel/types (20936 examples)