move instanceof functionality to separate plugin - fixes #2745

This commit is contained in:
Sebastian McKenzie
2015-11-03 19:22:51 +00:00
parent 1c3b4aa410
commit a9ac3b0c94
8 changed files with 40 additions and 16 deletions

View File

@@ -0,0 +1,12 @@
export default function ({ types: t }) {
return {
visitor: {
BinaryExpression(path) {
let { node } = path;
if (node.operator === "instanceof") {
path.replaceWith(t.callExpression(this.addHelper("instanceof"), [node.left, node.right]));
}
}
}
};
}