Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
transformBinaryExpression(tree) {
tree.left = this.transformAny(tree.left);
tree.right = this.transformAny(tree.right);
if (tree.operator.type === EQUAL_EQUAL_EQUAL) {
// `a === b` -> `identical(a, b)`
return createCallExpression(createIdentifierExpression('identical'),
createArgumentList([tree.left, tree.right]));
}
if (tree.operator.type === NOT_EQUAL_EQUAL) {
// `a !== b` -> `!identical(a, b)`
// TODO(vojta): do this in a cleaner way.
return createCallExpression(createIdentifierExpression('!identical'),
createArgumentList([tree.left, tree.right]));
}
return tree;
}
}