Skip to content

Commit

Permalink
[compile] semantic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Oct 16, 2013
1 parent 042aed7 commit 6c36bb4
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions lib/compile.js
Expand Up @@ -32,14 +32,12 @@ function compileRules(arr){
}

function reduceRules(a, b){
if(
b === falseFunc ||
a === trueFunc
) return a;
if(
a === falseFunc ||
b === trueFunc
) return b;
if(b === falseFunc || a === trueFunc){
return a;
}
if(a === falseFunc || b === trueFunc){
return b;
}

return function combine(elem){
return a(elem) || b(elem);
Expand All @@ -59,12 +57,8 @@ var Pseudos = require("./pseudos.js"),
filters.not = function(next, select){
var func = compile(select);

if(func === falseFunc){
return next;
}
if(func === trueFunc){
return falseFunc;
}
if(func === falseFunc) return next;
if(func === trueFunc) return falseFunc;

return function(elem){
return !func(elem) && next(elem);
Expand Down

0 comments on commit 6c36bb4

Please sign in to comment.