How to use the isJSXExpressionContainer function from @babel/types
Find comprehensive JavaScript @babel/types.isJSXExpressionContainer code examples handpicked from public code repositorys.
GitHub: alijk-fe/motor-rax
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, };
664
11
1
+ 7 other calls in file
GitHub: startupjs/startupjs
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.
42
92
8
+ 15 other calls in file
GitHub: caiwuu/Typex
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)
2
40
3
GitHub: menhal/anu
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;
330
0
0
+ 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'));
1
2
1
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"), []),
0
0
1
+ 44 other calls in file
@babel/types.identifier is the most popular function in @babel/types (20936 examples)