Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pouchdb-selector-core

Package Overview
Dependencies
Maintainers
5
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 6.2.0 to 6.2.1-prerelease

src/in-memory-filter.js

33

lib/index.es.js

@@ -304,6 +304,2 @@ import { clone } from 'pouchdb-utils';

return inMemoryFields.every(function (field) {
if (isDesignDoc(doc)) {
return false;
}
var matcher = selector[field];

@@ -320,6 +316,2 @@ var parsedField = parseField(field);

function isDesignDoc(doc) {
return /^_design\//.test(doc._id);
}
function matchSelector(matcher, doc, parsedField, docFieldValue) {

@@ -360,3 +352,3 @@ if (!matcher) {

'" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, ' +
'$nin, $size, $mod, $regex, $elemMatch, $type or $all');
'$nin, $size, $mod, $regex, $elemMatch, $type, $allMatch or $all');
}

@@ -466,2 +458,23 @@ return matchers[userOperator](doc, userValue, parsedField, docFieldValue);

'$allMatch': function (doc, userValue, parsedField, docFieldValue) {
if (!Array.isArray(docFieldValue)) {
return false;
}
/* istanbul ignore next */
if (docFieldValue.length === 0) {
return false;
}
if (typeof docFieldValue[0] === 'object') {
return docFieldValue.every(function (val) {
return rowFilter(val, userValue, Object.keys(userValue));
});
}
return docFieldValue.every(function (val) {
return matchSelector(userValue, doc, parsedField, val);
});
},
'$eq': function (doc, userValue, parsedField, docFieldValue) {

@@ -535,3 +548,3 @@ return fieldIsNotUndefined(docFieldValue) && collate(docFieldValue, userValue) === 0;

// match the CouchDB error message
throw 'Selector error: expected a JSON object';
throw new Error('Selector error: expected a JSON object');
}

@@ -538,0 +551,0 @@

@@ -308,6 +308,2 @@ 'use strict';

return inMemoryFields.every(function (field) {
if (isDesignDoc(doc)) {
return false;
}
var matcher = selector[field];

@@ -324,6 +320,2 @@ var parsedField = parseField(field);

function isDesignDoc(doc) {
return /^_design\//.test(doc._id);
}
function matchSelector(matcher, doc, parsedField, docFieldValue) {

@@ -364,3 +356,3 @@ if (!matcher) {

'" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, ' +
'$nin, $size, $mod, $regex, $elemMatch, $type or $all');
'$nin, $size, $mod, $regex, $elemMatch, $type, $allMatch or $all');
}

@@ -470,2 +462,23 @@ return matchers[userOperator](doc, userValue, parsedField, docFieldValue);

'$allMatch': function (doc, userValue, parsedField, docFieldValue) {
if (!Array.isArray(docFieldValue)) {
return false;
}
/* istanbul ignore next */
if (docFieldValue.length === 0) {
return false;
}
if (typeof docFieldValue[0] === 'object') {
return docFieldValue.every(function (val) {
return rowFilter(val, userValue, Object.keys(userValue));
});
}
return docFieldValue.every(function (val) {
return matchSelector(userValue, doc, parsedField, val);
});
},
'$eq': function (doc, userValue, parsedField, docFieldValue) {

@@ -539,3 +552,3 @@ return fieldIsNotUndefined(docFieldValue) && pouchdbCollate.collate(docFieldValue, userValue) === 0;

// match the CouchDB error message
throw 'Selector error: expected a JSON object';
throw new Error('Selector error: expected a JSON object');
}

@@ -542,0 +555,0 @@

{
"name": "pouchdb-selector-core",
"version": "6.2.0",
"version": "6.2.1-prerelease",
"description": "PouchDB's core selector code",

@@ -10,12 +10,3 @@ "main": "./lib/index.js",

"repository": "https://github.com/pouchdb/pouchdb",
"jsnext:main": "./lib/index.es.js",
"dependencies": {
"pouchdb-collate": "6.2.0",
"pouchdb-utils": "6.2.0"
},
"files": [
"lib",
"dist",
"tonic-example.js"
]
"jsnext:main": "./src/index.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