Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function _mapOp(direction) {
var ltype, rtype, op;
if (!jsprim.hasKey(b.index, f.attribute)) {
throw new NotIndexedError(b.name, f.toString());
}
ltype = b.index[f.attribute].type;
if (!jsprim.hasKey(TYPES, ltype)) {
throw new InvalidQueryError(f.toString());
}
if (TYPES[ltype][direction] === null) {
throw new InvalidQueryError(f.toString());
}
rtype = TYPES[ltype][direction].type;
op = TYPES[ltype][direction].op;
v = parse(f.value, f, rtype);
args.push(v.value);
if (TYPES[ltype].array) {
clause += util.format('$%d::%s %s ANY(%s)',
function _mapOp(direction) {
var ltype, rtype, op;
if (!jsprim.hasKey(b.index, f.attribute)) {
throw new NotIndexedError(b.name, f.toString());
}
ltype = b.index[f.attribute].type;
if (!jsprim.hasKey(TYPES, ltype)) {
throw new InvalidQueryError(f.toString());
}
if (TYPES[ltype][direction] === null) {
throw new InvalidQueryError(f.toString());
}
rtype = TYPES[ltype][direction].type;
op = TYPES[ltype][direction].op;
v = parse(f.value, f, rtype);
function _value(schema, key, val, filter) {
if (!jsprim.hasKey(schema, key)) {
switch (key) {
case '_id':
case '_txn_snap':
case '_mtime':
return parse(val, filter, 'number');
case '_etag':
case '_key':
return parse(val, filter, 'string');
default:
return {
isArray: false,
value: undefined
};
}
}
try {
tunables = JSON.parse(fs.readFileSync(this.tunablesFile, 'utf8'));
} catch (e) {
throw new verror.VError(e, 'failed to load %s', this.tunablesFile);
}
assert.ifError(mod_jsprim.validateJsonObject(TUNABLES_SCHEMA, tunables));
function copy(source) {
mod_jsprim.forEachKey(source, function (key, value) {
options[key] = value;
});
}
if (mod_jsprim.hasKey(tunables, 'common')) {
copy(tunables['common']);
}
if (mod_jsprim.hasKey(tunables, major)) {
copy(tunables[major]);
}
if (mod_jsprim.hasKey(tunables, version)) {
copy(tunables[version]);
}
return (options);
};
function _matchPgOnly(b, filter) {
if (!jsprim.hasKey(b.index, filter.attribute)) {
throw new NotIndexedError(b.name, filter.toString());
}
filter.matches = _matchAlwaysTrue;
}
throw new verror.VError(e, 'failed to load %s', this.tunablesFile);
}
assert.ifError(mod_jsprim.validateJsonObject(TUNABLES_SCHEMA, tunables));
function copy(source) {
mod_jsprim.forEachKey(source, function (key, value) {
options[key] = value;
});
}
if (mod_jsprim.hasKey(tunables, 'common')) {
copy(tunables['common']);
}
if (mod_jsprim.hasKey(tunables, major)) {
copy(tunables[major]);
}
if (mod_jsprim.hasKey(tunables, version)) {
copy(tunables[version]);
}
return (options);
};