Skip to content

Commit 56dbbe6

Browse files
committed
Throw error when rule type is not supported
fixes #82
1 parent da7318e commit 56dbbe6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lib/compile.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ function isTraversal(t){
118118
function compileRules(rules, options, context){
119119
return rules.reduce(function(func, rule){
120120
if(func === falseFunc) return func;
121+
122+
if(!(rule.type in Rules)){
123+
throw new Error(
124+
"Rule type " + rule.type + " is not supported by css-select"
125+
);
126+
}
127+
121128
return Rules[rule.type](func, rule, options, context);
122129
}, (options && options.rootFunc) || trueFunc);
123130
}

0 commit comments

Comments
 (0)