Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!schema[k])
return false;
switch (schema[k].type) {
case 'boolean':
return v ? 'true' : 'false';
case 'number':
return v;
default:
return '\'' + v + '\'';
}
}
var f = ldap.parseFilter(query);
var where = '';
var val;
switch (f.type) {
case 'and':
case 'or':
var vals = [];
for (var i = 0; i < f.filters.length; i++) {
var _f = f.filters[i].toString();
val = compileQuery(bucket, schema, _f, true);
if (val)
vals.push(val);
}
if (!child && vals.length === 0)
throw new NotIndexedError(bucket, query);
where += '(' + vals.join(' ' + f.type.toUpperCase() + ' ') + ')';
}))
}
if(or.length > 0){
tmp.addFilter(new ldap.OrFilter({filters: or}));
}
continue;
}
}else{
var query = conditions[i].query;
var args = conditions[i].args;
//TODO: put args into query
var custom = ldap.parseFilter(query);
if(conditions.length === 1){
operator.filter = custom;
}else{
tmp.addFilter(custom);
}
}
}
};