Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function checkFieldsLogicallySound(indexFields, selector) {
var firstField = indexFields[0];
var matcher = selector[firstField];
if (typeof matcher === 'undefined') {
/* istanbul ignore next */
return true;
}
var isInvalidNe = Object.keys(matcher).length === 1 &&
getKey(matcher) === '$ne';
return !isInvalidNe;
}
function getSingleFieldCoreQueryPlan(selector, index) {
var field = getKey(index.def.fields[0]);
//ignoring this because the test to exercise the branch is skipped at the moment
/* istanbul ignore next */
var matcher = selector[field] || {};
var inMemoryFields = [];
var userOperators = Object.keys(matcher);
var combinedOpts;
userOperators.forEach(function (userOperator) {
if (isNonLogicalMatcher(userOperator)) {
inMemoryFields.push(field);
}
var userValue = matcher[userOperator];
function getKeyFromDoc(doc, index) {
var res = [];
for (var i = 0; i < index.def.fields.length; i++) {
var field = getKey(index.def.fields[i]);
res.push(doc[field]);
}
return res;
}
function userOperatorLosesPrecision(selector, field) {
var matcher = selector[field];
var userOperator = getKey(matcher);
return userOperator !== '$eq';
}