How to use the parseExpression function from babylon
Find comprehensive JavaScript babylon.parseExpression code examples handpicked from public code repositorys.
16 17 18 19 20 21 22 23 24 25
if (t.isIdentifier(nodePath.node.id)) { const replaceCode = state.replacers[`${kind} ${nodePath.node.id.name} =`] if (replaceCode) { const newAst = parseExpression(replaceCode) nodePath.get('init').replaceWith(newAst) } } },
1
20
0
20 21 22 23 24 25 26 27 28 29 30 31
const path = require('path'); const debug = createDebug('babel-plugin-graphql-tag'); // eslint-disable-next-line no-restricted-syntax const uniqueFn = parseExpression(` (definitions) => { const names = {}; return definitions.filter(definition => { if (definition.kind !== 'FragmentDefinition') {
1
0
0
GitHub: aladham1/maan
323 324 325 326 327 328 329 330 331 332
} lastSrc = src; lastConstants = constants; var ast; try { ast = babylon_1.parseExpression(src, options); } catch (ex) { return (lastWasConstant = false); }
0
0
0
+ 3 other calls in file
GitHub: NaturalDragon/study
8 9 10 11 12 13 14 15 16 17 18
let ast = babylon.parse(sourceCode, { sourceType: 'module', plugins: ['jsx'] }); let a = babylon.parseExpression(sourceCode, { sourceType: 'module', plugins: ['jsx'] }) console.log(ast)
0
0
0
+ 2 other calls in file
11 12 13 14 15 16 17 18 19 20
}"${i === path.node.properties.length - 1 ? "" : ","}`; }, "" ); const newNode = babylon.parseExpression( `JSON.parse({${stringifiedObject}})` ); // This is an infinite loop that needs to be fixed
0
0
0
GitHub: chenliang2016/Specs
24 25 26 27 28 29 30 31 32 33 34 35
const ASSET_REGISTRY_PATH = 'react-native/Libraries/Image/AssetRegistry'; function generateAssetCodeFileAst(assetDescriptor: AssetDescriptor): Object { const properDescriptor = filterObject(assetDescriptor, assetPropertyBlacklist); const descriptorAst = babylon.parseExpression(JSON.stringify(properDescriptor)); const t = babel.types; const moduleExports = t.memberExpression(t.identifier('module'), t.identifier('exports')); const requireCall = t.callExpression(t.identifier('require'), [t.stringLiteral(ASSET_REGISTRY_PATH)]);
0
0
0
babylon.parse is the most popular function in babylon (166 examples)