|
@@ -54,8 +54,8 @@ exports.operators = { |
|
|
}),
|
|
|
contains: filter(function(array, value){
|
|
|
if(typeof value == "function"){
|
|
|
- return array instanceof Array && array.some(function(i){
|
|
|
- return value([i]).length;
|
|
|
+ return array instanceof Array && array.some(function(v){
|
|
|
+ return value.call([v]).length;
|
|
|
});
|
|
|
}
|
|
|
else{
|
|
@@ -64,8 +64,8 @@ exports.operators = { |
|
|
}),
|
|
|
excludes: filter(function(array, value){
|
|
|
if(typeof value == "function"){
|
|
|
- return !array.some(function(i){
|
|
|
- return value([i]).length;
|
|
|
+ return !array.some(function(v){
|
|
|
+ return value.call([v]).length;
|
|
|
});
|
|
|
}
|
|
|
else{
|
|
@@ -351,18 +351,18 @@ function query(query, options, target){ |
|
|
// item['foo.bar'] ==> (item && item.foo && item.foo.bar && ...)
|
|
|
var path = value.args[0];
|
|
|
var target = value.args[1];
|
|
|
- if(path instanceof Array){
|
|
|
- var item = "";
|
|
|
+ if (typeof target == "undefined"){
|
|
|
+ var item = "item";
|
|
|
+ target = path;
|
|
|
+ }else if(path instanceof Array){
|
|
|
+ var item = "item";
|
|
|
var escaped = [];
|
|
|
for(var i = 0;i < path.length; i++){
|
|
|
escaped.push(stringify(path[i]));
|
|
|
item +="&&item[" + escaped.join("][") + ']';
|
|
|
}
|
|
|
- }else if (typeof path == "undefined"){
|
|
|
- var item = "";
|
|
|
- target = path;
|
|
|
}else{
|
|
|
- var item = "&&item[" + stringify(path) + "]";
|
|
|
+ var item = "item&&item[" + stringify(path) + "]";
|
|
|
}
|
|
|
// comparison to regexps are special: we cope with eq(), ne(), the others coerce regexp to string
|
|
|
if (value.args[1] instanceof RegExp) {
|
|
|
0 comments on commit
b16713b