New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pouchdb-selector-core

Package Overview
Dependencies
Maintainers
10
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pouchdb-selector-core - npm Package Compare versions

Comparing version 7.3.1 to 8.0.0

50

lib/index.es.js

@@ -271,11 +271,10 @@ import { clone } from 'pouchdb-utils';

var result = clone(input);
var wasAnded = false;
//#7458: if $and is present in selector (at any level) merge nested $and
if (isAndInSelector(result, false)) {
result = mergeAndedSelectorsNested(result);
if ('$and' in result) {
result = mergeAndedSelectors(result['$and']);
}
wasAnded = true;
//#7458: if $and is present in selector (at any level) merge nested $and
if (isAndInSelector(result, false)) {
result = mergeAndedSelectorsNested(result);
if ('$and' in result) {
result = mergeAndedSelectors(result['$and']);
}
}

@@ -313,11 +312,2 @@ ['$or', '$nor'].forEach(function (orOrNor) {

matcher = {$eq: matcher};
} else if (!wasAnded) {
// These values must be placed in an array because these operators can be used multiple times on the same field
// when $and is used, mergeAndedSelectors takes care of putting them into arrays, otherwise it's done here:
if ('$ne' in matcher) {
matcher.$ne = [matcher.$ne];
}
if ('$regex' in matcher) {
matcher.$regex = [matcher.$regex];
}
}

@@ -327,5 +317,31 @@ result[field] = matcher;

normalizeArrayOperators(result);
return result;
}
//
// The $ne and $regex values must be placed in an array because these operators can be used multiple times on the same field.
// When $and is used, mergeAndedSelectors takes care of putting some of them into arrays, otherwise it's done here.
//
function normalizeArrayOperators(selector) {
Object.keys(selector).forEach(function (field) {
var matcher = selector[field];
if (Array.isArray(matcher)) {
matcher.forEach(function (matcherItem) {
if (matcherItem && typeof matcherItem === 'object') {
normalizeArrayOperators(matcherItem);
}
});
} else if (field === '$ne') {
selector.$ne = [matcher];
} else if (field === '$regex') {
selector.$regex = [matcher];
} else if (matcher && typeof matcher === 'object') {
normalizeArrayOperators(matcher);
}
});
}
// create a comparator based on the sort object

@@ -332,0 +348,0 @@ function createFieldSorter(sort) {

@@ -275,11 +275,10 @@ 'use strict';

var result = pouchdbUtils.clone(input);
var wasAnded = false;
//#7458: if $and is present in selector (at any level) merge nested $and
if (isAndInSelector(result, false)) {
result = mergeAndedSelectorsNested(result);
if ('$and' in result) {
result = mergeAndedSelectors(result['$and']);
}
wasAnded = true;
//#7458: if $and is present in selector (at any level) merge nested $and
if (isAndInSelector(result, false)) {
result = mergeAndedSelectorsNested(result);
if ('$and' in result) {
result = mergeAndedSelectors(result['$and']);
}
}

@@ -317,11 +316,2 @@ ['$or', '$nor'].forEach(function (orOrNor) {

matcher = {$eq: matcher};
} else if (!wasAnded) {
// These values must be placed in an array because these operators can be used multiple times on the same field
// when $and is used, mergeAndedSelectors takes care of putting them into arrays, otherwise it's done here:
if ('$ne' in matcher) {
matcher.$ne = [matcher.$ne];
}
if ('$regex' in matcher) {
matcher.$regex = [matcher.$regex];
}
}

@@ -331,5 +321,31 @@ result[field] = matcher;

normalizeArrayOperators(result);
return result;
}
//
// The $ne and $regex values must be placed in an array because these operators can be used multiple times on the same field.
// When $and is used, mergeAndedSelectors takes care of putting some of them into arrays, otherwise it's done here.
//
function normalizeArrayOperators(selector) {
Object.keys(selector).forEach(function (field) {
var matcher = selector[field];
if (Array.isArray(matcher)) {
matcher.forEach(function (matcherItem) {
if (matcherItem && typeof matcherItem === 'object') {
normalizeArrayOperators(matcherItem);
}
});
} else if (field === '$ne') {
selector.$ne = [matcher];
} else if (field === '$regex') {
selector.$regex = [matcher];
} else if (matcher && typeof matcher === 'object') {
normalizeArrayOperators(matcher);
}
});
}
// create a comparator based on the sort object

@@ -336,0 +352,0 @@ function createFieldSorter(sort) {

{
"name": "pouchdb-selector-core",
"version": "7.3.1",
"version": "8.0.0",
"description": "PouchDB's core selector code",

@@ -16,4 +16,4 @@ "main": "./lib/index.js",

"dependencies": {
"pouchdb-collate": "7.3.1",
"pouchdb-utils": "7.3.1"
"pouchdb-collate": "8.0.0",
"pouchdb-utils": "8.0.0"
},

@@ -20,0 +20,0 @@ "module": "./lib/index.es.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc