How to use the isBinaryExpression function from @babel/types

Find comprehensive JavaScript @babel/types.isBinaryExpression code examples handpicked from public code repositorys.

145
146
147
148
149
150
151
152
153
154
    }
}

function add_Mem_str(path) {
    let node = path.node;
    if (node.computed && t.isBinaryExpression(node.property) && node.property.operator == '+') {
        let BinNode = node.property;//属性节点
        let tmpast = parse.parse(generator(BinNode).code);
        let addstr = '';
        traverse(tmpast, {
fork icon54
star icon86
watch icon6

+ 7 other calls in file

180
181
182
183
184
185
186
187
188
189
const node_ = path_.node;
if (
  node_.argument &&
  t.isSequenceExpression(node_.argument) &&
  t.isAssignmentExpression(node_.argument.expressions[0]) &&
  t.isBinaryExpression(node_.argument.expressions[0].right) &&
  node_.argument.expressions[0].right.operator === '-' &&
  !isNaN(node_.argument.expressions[0].right.right.value)
) {
  offset = node_.argument.expressions[0].right.right.value;
fork icon5
star icon15
watch icon1

+ 63 other calls in file

84
85
86
87
88
89
90
91
92
93
      }
    })
  }
} else if ( t.isArrayExpression(path.node.init) ){
  // No handling for arrays right now
} else if ( t.isBinaryExpression(path.node.init) ){
  // No handling for ^^ right now
} else if ( t.isFunctionExpression(path.node.init) ){
  // No handling for ^^ right now
} else if ( t.isUnaryExpression(path.node.init) ){
fork icon1
star icon6
watch icon7

507
508
509
510
511
512
513
514
515
516
let parentPath = path.parentPath
if (t.isIfStatement(parentPath) || t.isLogicalExpression(parentPath)) {
    let left = path.get("left")
    let right = path.get("right")

    if (t.isBinaryExpression(left) && t.isBinaryExpression(right)) {
        mergeBinaryExpression(path)
    } else {
        if (t.isLogicalExpression(left)) {
            mergeBinaryExpression(left)
fork icon220
star icon0
watch icon0

85
86
87
88
89
90
91
92
93
94
95
    expressionStatement: true
  });
}


function Binary(node, parent) {
  if (node.operator === "**" && t.isBinaryExpression(parent, {
    operator: "**"
  })) {
    return parent.left === node;
  }
fork icon0
star icon0
watch icon0

+ 5 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 (20936 examples)