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'
  }
fork icon5
star icon43
watch icon10

+ 22 other calls in file

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');
}
fork icon510
star icon0
watch icon2

+ 7 other calls in file

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;
fork icon0
star icon1
watch icon2

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;
fork icon0
star icon2
watch icon0

+ 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) &&
fork icon0
star icon0
watch icon0

+ 6 other calls in file

Other functions in babel-types

Sorted by popularity

function icon

babel-types.identifier is the most popular function in babel-types (4076 examples)