Open heri16 opened 6 years ago
I didn't test but this patch should work:
$ git diff
diff --git a/index.js b/index.js
index fd023f9..686b3f3 100644
--- a/index.js
+++ b/index.js
@@ -22,25 +22,11 @@ function prune(code) {
estraverse.replace(ast, {
leave: function leave(node, parent) {
- var ret;
-
- if ('IfStatement' === node.type) {
- if ('BinaryExpression' !== node.test.type) return;
-
- if ('self' === node.test.left.argument.name) {
- node.alternate = null;
- } else if ('global' === node.test.left.argument.name) {
- ret = node.alternate;
- }
-
- return ret;
- }
-
if (
'BlockStatement' === node.type
&& 'FunctionExpression' === parent.type
) {
- return node.body[0].alternate.alternate;
+ return node.body[0].consequent;
}
}
});
Anyway I think it's out of the scope of this module.
Is there a plugin/flag that does similar to this but leaves only CommonJS support?