In Ox.api, add support for values that are arrays
This commit is contained in:
parent
909184fbba
commit
2223fcfd2b
1 changed files with 13 additions and 1 deletions
|
@ -363,10 +363,18 @@ Ox.api = function(items, options) {
|
|||
test = {
|
||||
'=': function(a, b) {
|
||||
return Ox.isArray(b) ? a >= b[0] && a < b[1]
|
||||
: Ox.isArray(a) ? a.some(function(value) {
|
||||
return value.indexOf(b) > -1;
|
||||
})
|
||||
: Ox.isString(a) ? a.indexOf(b) > -1
|
||||
: a === b;
|
||||
},
|
||||
'==': function(a, b) { return a === b; },
|
||||
'==': function(a, b) {
|
||||
return Ox.isArray(a) ? a.some(function(value) {
|
||||
return value === b;
|
||||
})
|
||||
: a === b;
|
||||
},
|
||||
'<': function(a, b) { return a < b; },
|
||||
'<=': function(a, b) { return a <= b; },
|
||||
'>': function(a, b) { return a > b; },
|
||||
|
@ -376,6 +384,10 @@ Ox.api = function(items, options) {
|
|||
};
|
||||
if (Ox.isString(itemValue)) {
|
||||
itemValue = itemValue.toLowerCase();
|
||||
} else if (Ox.isArray(itemValue) && Ox.isString(itemValue[0])) {
|
||||
itemValue = itemValue.map(function(value) {
|
||||
return value.toLowerCase();
|
||||
});
|
||||
}
|
||||
if (api.enums[key] && (
|
||||
operator.indexOf('<') > -1
|
||||
|
|
Loading…
Reference in a new issue