diff --git a/lib/rewrite.js b/lib/rewrite.js index f156a63..a2c42b3 100644 --- a/lib/rewrite.js +++ b/lib/rewrite.js @@ -133,9 +133,6 @@ function match(wildcards, pattern, node) { if (pattern.operator != node.operator) { return false; } - if (pattern.prefix != node.prefix) { - return false; - } return match(wildcards, pattern.argument, node.argument); case 'ArrayExpression': return partial(wildcards, pattern.elements, node.elements); diff --git a/tests/rewrite.js b/tests/rewrite.js index 3c3ca0c..f2ba22e 100644 --- a/tests/rewrite.js +++ b/tests/rewrite.js @@ -43,7 +43,7 @@ describe('jsfmt.rewrite', function() { .toString().should.eql('function test() { return [\n 0,\n 1,\n 2\n].map(function (val) {\n return val * val;\n}); }'); }); - it('should be able to search for unary expression', function() { + it('should be able to rewrite unary expression', function() { jsfmt.rewrite('var test = !0;', '!0 -> true').toString().should.eql('var test = true;'); jsfmt.rewrite('var test = !0;', '!0 -> !1').toString().should.eql('var test = !1;'); });