1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports.default = _default;
|
5 |
|
6 | function _default(_ref) {
|
7 | var t = _ref.types;
|
8 | return {
|
9 | visitor: {
|
10 | BinaryExpression: function BinaryExpression(path) {
|
11 | var node = path.node;
|
12 |
|
13 | if (node.operator === "instanceof") {
|
14 | var helper = this.addHelper("instanceof");
|
15 | var isUnderHelper = path.findParent(function (path) {
|
16 | return path.isVariableDeclarator() && path.node.id === helper || path.isFunctionDeclaration() && path.node.id && path.node.id.name === helper.name;
|
17 | });
|
18 |
|
19 | if (isUnderHelper) {
|
20 | return;
|
21 | } else {
|
22 | path.replaceWith(t.callExpression(helper, [node.left, node.right]));
|
23 | }
|
24 | }
|
25 | }
|
26 | }
|
27 | };
|
28 | } |
\ | No newline at end of file |