How to use the isClassExpression function from @babel/types

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

40
41
42
43
44
45
46
47
48
49
}

renamed.add(binding.identifier);

if (babelTypes.isClassDeclaration(binding.path.node) ||
    babelTypes.isClassExpression(binding.path.node)) {
  path.scope.rename(name, '__c_' + context.classIndex++);
} else if (babelTypes.isFunctionDeclaration(binding.path.node) ||
           babelTypes.isFunctionExpression(binding.path.node)) {
  path.scope.rename(name, '__f_' + context.funcIndex++);
fork icon46
star icon35
watch icon0

68
69
70
71
72
73
74
75
76
77

do {
  isComponent = isComponent || (
    t.isArrowFunctionExpression(currentPath.node)
    || t.isFunctionExpression(currentPath.node)
    || t.isClassExpression(currentPath.node)
  )

  prevPaths.push(currentPath)
  currentPath = currentPath.parentPath
fork icon10
star icon0
watch icon1

+ 5 other calls in file

55
56
57
58
59
60
61
62
63
64
65
66
67
  "/": 9,
  "%": 9,
  "**": 10
};


const isClassExtendsClause = (node, parent) => (t.isClassDeclaration(parent) || t.isClassExpression(parent)) && parent.superClass === node;


const hasPostfixPart = (node, parent) => (t.isMemberExpression(parent) || t.isOptionalMemberExpression(parent)) && parent.object === node || (t.isCallExpression(parent) || t.isOptionalCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node || t.isTaggedTemplateExpression(parent) && parent.tag === node || t.isTSNonNullExpression(parent);


function NullableTypeAnnotation(node, parent) {
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)