How to use the isAssignmentExpression function from babel-types
Find comprehensive JavaScript babel-types.isAssignmentExpression code examples handpicked from public code repositorys.
180 181 182 183 184 185 186 187 188 189
* - further compacts sequential pug_html = pug_html + stringLiteral */ ast_postprocess: function(ast) { let needCompaction = function(c) { return t.isExpressionStatement(c) && t.isAssignmentExpression(c.expression) && c.expression.left.name === 'pug_html' && t.isBinaryExpression(c.expression.right) && c.expression.right.left.name === 'pug_html' }
5
43
10
+ 22 other calls in file
GitHub: btd/documentation
142 143 144 145 146 147 148 149 150
/* * Deal with an oddity of espree: the jsdoc comment is attached to a different * node in the two expressions `a.b = c` vs `a.b = function () {}`. */ if (n.isExpressionStatement(path.node) && n.isAssignmentExpression(path.node.expression) && n.isMemberExpression(path.node.expression.left)) { path = path.get('expression').get('left'); }
510
0
2
+ 7 other calls in file
GitHub: Philmod/parcel
139 140 141 142 143 144 145 146 147
return parent.node.source.value === name; // e.g. var fs = require('fs'); } else if ( t.isVariableDeclarator(bindingNode) || t.isAssignmentExpression(bindingNode) ) { let left = bindingNode.id || bindingNode.left; let right = bindingNode.init || bindingNode.right;
0
1
2
184 185 186 187 188 189 190 191 192
// Change displayName let displayNameExpression = ast.program.body.find( stmt => types.isExpressionStatement(stmt) && types.isAssignmentExpression(stmt.expression) && types.isMemberExpression(stmt.expression.left) && stmt.expression.left.object.name === 'newComponent' ).expression;
0
2
0
+ 3 other calls in file
134 135 136 137 138 139 140 141 142 143
*/ function resetTSClassProperty(body) { for (const method of body) { if (t.isClassMethod(method) && method.kind === 'constructor') { for (const statement of _.cloneDeep(method.body.body)) { if (t.isExpressionStatement(statement) && t.isAssignmentExpression(statement.expression)) { const expr = statement.expression; const { left, right } = expr; if (t.isMemberExpression(left) && t.isThisExpression(left.object) &&
0
0
0
+ 6 other calls in file
babel-types.identifier is the most popular function in babel-types (4076 examples)