How to use the toComputedKey function from babel-types
Find comprehensive JavaScript babel-types.toComputedKey code examples handpicked from public code repositorys.
180 181 182 183 184 185 186 187 188 189
// inline environment variables walk.simple(originalAst, { MemberExpression(node) { // Inline environment variables accessed on process.env if (matchesPattern(node.object, 'process.env')) { let key = babelTypes.toComputedKey(node); if (babelTypes.isStringLiteral(key)) { let val = babelTypes.valueToNode(process.env[key.value]); morph(node, val); }
0
49
0
+ 3 other calls in file
GitHub: mattdesl/parcel
18 19 20 21 22 23 24 25 26 27
module.exports = { MemberExpression(node, asset) { // Inline environment variables accessed on process.env if (matchesPattern(node.object, 'process.env')) { let key = types.toComputedKey(node); if (types.isStringLiteral(key)) { let val = types.valueToNode(process.env[key.value]); morph(node, val); asset.isAstDirty = true;
0
3
3
+ 13 other calls in file
babel-types.identifier is the most popular function in babel-types (4076 examples)