How to use the isJSXExpressionContainer function from @babel/types

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

30
31
32
33
34
35
36
37
38
39
case directiveIf:
case directiveElseif:
case directiveElse:
  return {
    type: conditionTypes[attributes[i].name.name],
    value: t.isJSXExpressionContainer(attributes[i].value)
      ? attributes[i].value.expression
      : attributes[i].value,
    index: i,
  };
fork icon664
star icon11
watch icon1

+ 7 other calls in file

112
113
114
115
116
117
118
119
120

// Check if styleName exists and if it can be processed
if (styleName != null) {
  if (!(
    t.isStringLiteral(styleName.node.value) ||
    t.isJSXExpressionContainer(styleName.node.value)
  )) {
    throw jsxOpeningElementPath.buildCodeFrameError(`
      styleName attribute has an unsupported type. It must be either a string or an expression.
fork icon42
star icon92
watch icon8

+ 15 other calls in file

83
84
85
86
87
88
89
90
91
92
  } else {
    return t.stringLiteral(node.name.name)
  }
}
function convertAttrValue(node) {
  return t.isJSXExpressionContainer(node.value)
    ? node.value.expression
    : node.value
    ? t.stringLiteral(node.value.value)
    : t.booleanLiteral(true)
fork icon2
star icon40
watch icon3

159
160
161
162
163
164
165
166
167
168
getAnu(state: any) {
    return state.file.opts.anu;
},
isLoopMap(astPath: any) {
    if (
        t.isJSXExpressionContainer(astPath.parentPath) ||
        t.isConditionalExpression(astPath.parentPath) ||
        t.isLogicalExpression(astPath.parentPath)
    ) {
        var callee = astPath.node.callee;
fork icon330
star icon0
watch icon0

+ 3 other calls in file

115
116
117
118
119
120
121
122
123
124
125
126
127
  };
}


const idOrNull = attr => t.isStringLiteral(attr) ? attr.value : null;


const expressionOrNull = attr => t.isJSXExpressionContainer(attr) ? attr.expression : null;


function genStoryExport(ast, context) {
  const storyName = idOrNull(getAttr(ast.openingElement, 'name'));
  const storyId = idOrNull(getAttr(ast.openingElement, 'id'));
fork icon1
star icon2
watch icon1

198
199
200
201
202
203
204
205
206
207
    initTemplate(child, element, attrsCollector);
  });
}

if (
  t.isJSXExpressionContainer(wrappedElement) ||
  t.isJSXText(wrappedElement)
) {
  ast = t.jSXElement(
    t.jSXOpeningElement(t.jSXIdentifier("div"), []),
fork icon0
star icon0
watch icon1

+ 44 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)