How to use the isJSXExpressionContainer function from babel-types

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

209
210
211
212
213
214
215
216
217
218
        }
      : {
          name: attr.name.name,
          // TODO: see if we can find  union of possible values. Eg. color = someVar ? 'green' : 'red'
          // TODO: for simple identifier types we could sometimes resolve to component prop types
          type: T.isJSXExpressionContainer(attr.value)
            ? resolveType(attr.value.expression)
            : resolveType(attr.value),
        }
),
fork icon9
star icon299
watch icon18

+ 5 other calls in file

46
47
48
49
50
51
52
53
54
55
getAnu(state) {
    return state.file.opts.anu;
},
isLoopMap(astPath) {
    if (
        t.isJSXExpressionContainer(astPath.parentPath) ||
        t.isConditionalExpression(astPath.parentPath)
    ) {
        var callee = astPath.node.callee;
        return (
fork icon330
star icon0
watch icon1

21
22
23
24
25
26
27
28
29
30

for (let i = 0; i < attributes.length; i++) {
    const attr = attributes[i];
    if (t.isJSXAttribute(attr)) {
        const name = PathUtils.getJSXAttributeName(attr);
        const expr = t.isJSXExpressionContainer(attr.value) ? attr.value.expression : attr.value;
        if (name === 'class' || name === 'className') {
            classExpressions.push(expr);
            attributes.splice(i--, 1);
        }
fork icon7
star icon0
watch icon2

+ 5 other calls in file

44
45
46
47
48
49
50
51
52
53
const subAttr = attributes[i];
if (t.isJSXAttribute(subAttr)) {
    const subAttrName = PathUtils.getJSXAttributeName(subAttr);
    if (subAttrName.indexOf('style-') === 0) {
        const key = camelCaseHyphens(subAttrName.slice('style-'.length));
        const value = t.isJSXExpressionContainer(subAttr.value) ? subAttr.value.expression : subAttr.value;
        subValues.push(t.objectProperty(t.stringLiteral(key), value));
        attributes.splice(i--, 1);
    }
}
fork icon7
star icon0
watch icon2

+ 5 other calls in file

8
9
10
11
12
13
14
15
16
17
let classNameAttr = classDirAttrs.find(prop => {
	return prop.name.name == 'className';
});
let classNameValue;

if (classNameAttr && t.isJSXExpressionContainer(classNameAttr.value)) {
	classNameValue = classNameAttr.value.expression;
} else if (classNameAttr && t.isStringLiteral(classNameAttr.value)) {
	classNameValue = classNameAttr.value;
}
fork icon0
star icon4
watch icon0

Other functions in babel-types

Sorted by popularity

function icon

babel-types.identifier is the most popular function in babel-types (4076 examples)