How to use the isForInStatement function from @babel/types

Find comprehensive JavaScript @babel/types.isForInStatement code examples handpicked from public code repositorys.

163
164
165
166
167
168
169
170
171
172
    }
},
VariableDeclaration: {
    exit(path) {
        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))
fork icon5
star icon27
watch icon1

+ 21 other calls in file

359
360
361
362
363
364
365
366
367
368

// 如标识符被修改过,则不能进行删除动作。
if (!binding || binding.constantViolations.length > 0) {
    return;
}
if (types.isForOfStatement(path.parentPath.parentPath) || types.isForInStatement(path.parentPath.parentPath) || types.isForStatement(path.parentPath.parentPath)) {
    return;
}

// 未被引用
fork icon2
star icon1
watch icon1

+ 82 other calls in file

263
264
265
266
267
268
269
270
271
272
  declaration: node
}) || arrowBody && t.isArrowFunctionExpression(parent, {
  body: node
}) || forHead && t.isForStatement(parent, {
  init: node
}) || forInHead && t.isForInStatement(parent, {
  left: node
}) || forOfHead && t.isForOfStatement(parent, {
  left: node
})) {
fork icon0
star icon0
watch icon0

+ 2 other calls in file

Other functions in @babel/types

Sorted by popularity

function icon

@babel/types.identifier is the most popular function in @babel/types (20936 examples)