How to use the JSXExpressionContainer function from babel-types
Find comprehensive JavaScript babel-types.JSXExpressionContainer code examples handpicked from public code repositorys.
GitHub: huenchao/schema2rax
50 51 52 53 54 55 56 57 58 59 60
function createConditionNode (condition,jsxNode){ let conditionNode = jsxNode; if (condition && condition.type === 'JSExpression' && condition.value){ let ast = parse(`Boolean(${condition.value})`); let left = ast.program.body[0].expression; conditionNode = t.JSXExpressionContainer(t.LogicalExpression('&&', left,jsxNode)); } return conditionNode; }
0
1
0
+ 29 other calls in file
GitHub: huenchao/schema2rax
49 50 51 52 53 54 55 56 57 58
// console.log('attrs:'+code); // 表达式转化 let ast = util.parseCode(code); let program = ast.program; if (program.body && program.body.length>0){ return t.JSXExpressionContainer(program.body[0].expression); }else{ return t.JSXExpressionContainer(t.stringLiteral(code)); } }
0
1
0
+ 7 other calls in file
babel-types.identifier is the most popular function in babel-types (4076 examples)