substring filter fixes for clients
This commit is contained in:
parent
ed1ae29054
commit
9b67dc608a
|
@ -154,9 +154,9 @@ function _parseString(str) {
|
|||
} else {
|
||||
filters.push(new SubstringFilter({
|
||||
attribute: stack[i].attribute,
|
||||
initial: vals.shift(),
|
||||
'final': vals.pop(),
|
||||
any: vals
|
||||
initial: vals.shift() || null,
|
||||
'final': vals.pop() || null,
|
||||
any: vals || null
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@ function SubstringFilter(options) {
|
|||
if (!options.attribute || typeof(options.attribute) !== 'string')
|
||||
throw new TypeError('options.attribute (string) required');
|
||||
this.attribute = options.attribute;
|
||||
this.initial = options.initial;
|
||||
this.initial = options.initial || null;
|
||||
this.any = options.any ? options.any.slice(0) : [];
|
||||
this['final'] = options['final'];
|
||||
this['final'] = options['final'] || null;
|
||||
} else {
|
||||
options = {};
|
||||
}
|
||||
|
@ -45,13 +45,19 @@ module.exports = SubstringFilter;
|
|||
|
||||
SubstringFilter.prototype.toString = function() {
|
||||
var str = '(' + this.attribute + '=';
|
||||
|
||||
if (this.initial)
|
||||
str += this.initial + '*';
|
||||
str += this.initial;
|
||||
|
||||
str += '*';
|
||||
|
||||
this.any.forEach(function(s) {
|
||||
str += s + '*';
|
||||
});
|
||||
|
||||
if (this['final'])
|
||||
str += this['final'];
|
||||
|
||||
str += ')';
|
||||
|
||||
return str;
|
||||
|
|
Loading…
Reference in New Issue