(path)
| 9 | |
| 10 | visitor: { |
| 11 | BinaryExpression(path) { |
| 12 | const { node } = path; |
| 13 | if (node.operator === "instanceof") { |
| 14 | const helper = this.addHelper("instanceof"); |
| 15 | const isUnderHelper = path.findParent(path => { |
| 16 | return ( |
| 17 | (path.isVariableDeclarator() && path.node.id === helper) || |
| 18 | (path.isFunctionDeclaration() && |
| 19 | path.node.id?.name === helper.name) |
| 20 | ); |
| 21 | }); |
| 22 | |
| 23 | if (isUnderHelper) { |
| 24 | return; |
| 25 | } else { |
| 26 | path.replaceWith(t.callExpression(helper, [node.left, node.right])); |
| 27 | } |
| 28 | } |
| 29 | }, |
| 30 | }, |
| 31 | }; |
| 32 | }); |
nothing calls this directly
no test coverage detected