How to use the isFor function from @babel/types
Find comprehensive JavaScript @babel/types.isFor code examples handpicked from public code repositorys.
GitHub: omarjuice/algo-viz
167 168 169 170 171 172 173 174 175 176
const declarations = [] const isFor = t.isForInStatement(path.parent) || t.isForOfStatement(path.parent) path.get("declarations").forEach(traverseDeclarations(path, isFor, declarations)) if (isFor) { const parent = path.findParent(parent => t.isFor(parent)) parent.node.body.body = [ ...declarations.map(([node, details]) => proxy(node, details)), ...parent.node.body.body
5
27
1
+ 21 other calls in file
138 139 140 141 142 143 144 145 146 147 148 149
function TSInferType(node, parent) { return t.isTSArrayType(parent) || t.isTSOptionalType(parent); } function BinaryExpression(node, parent) { return node.operator === "in" && (t.isVariableDeclarator(parent) || t.isFor(parent)); } function SequenceExpression(node, parent) { if (t.isForStatement(parent) || t.isThrowStatement(parent) || t.isReturnStatement(parent) || t.isIfStatement(parent) && parent.test === node || t.isWhileStatement(parent) && parent.test === node || t.isForInStatement(parent) && parent.right === node || t.isSwitchStatement(parent) && parent.discriminant === node || t.isExpressionStatement(parent) && parent.expression === node) {
0
0
0
+ 2 other calls in file
@babel/types.identifier is the most popular function in @babel/types (20936 examples)