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

penseur

Package Overview
Dependencies
Maintainers
1
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

penseur - npm Package Compare versions

Comparing version 4.1.0 to 4.1.1

18

lib/criteria.js

@@ -63,3 +63,4 @@ 'use strict';

const lines = internals.flatten(this.criteria, []);
const edges = [];
const lines = internals.flatten(this.criteria, [], edges);
if (!lines.length) {

@@ -112,2 +113,12 @@ return;

this.criteria = (tests.length === 1 ? tests[0] : RethinkDB.and(RethinkDB.args(tests)));
if (edges.length) {
let typeCheck = internals.row(edges[0]).typeOf().eq('OBJECT');
for (let i = 1; i < edges.length; ++i) {
typeCheck = RethinkDB.and(typeCheck, internals.row(edges[i]).typeOf().eq('OBJECT'));
}
this.criteria = typeCheck.and(this.criteria);
}
}

@@ -117,3 +128,3 @@ };

internals.flatten = function (criteria, path) {
internals.flatten = function (criteria, path, edges) {

@@ -128,3 +139,4 @@ const keys = Object.keys(criteria);

if (typeof value === 'object') {
lines = lines.concat(internals.flatten(value, location));
edges.push(location);
lines = lines.concat(internals.flatten(value, location, edges));
}

@@ -131,0 +143,0 @@ else {

2

package.json
{
"name": "penseur",
"description": "Lightweight RethinkDB wrapper",
"version": "4.1.0",
"version": "4.1.1",
"author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)",

@@ -6,0 +6,0 @@ "repository": "git://github.com/hueniverse/penseur",

@@ -388,2 +388,46 @@ 'use strict';

});
it('handles query into nested object where item is not an object', (done) => {
const db = new Penseur.Db('penseurtest');
db.establish(['test'], (err) => {
expect(err).to.not.exist();
db.test.insert([{ id: 1, a: 1, b: false }, { id: 2, a: 2, b: { c: 1 } }, { id: 3, a: 1, b: { c: 1 } }], (err, keys) => {
expect(err).to.not.exist();
db.test.query({ a: 1, b: { c: 1 } }, (err, result) => {
expect(err).to.not.exist();
expect(result).to.deep.equal([{ id: 3, a: 1, b: { c: 1 } }]);
done();
});
});
});
});
it('handles query into double nested object where item is not an object', (done) => {
const db = new Penseur.Db('penseurtest');
db.establish(['test'], (err) => {
expect(err).to.not.exist();
db.test.insert([
{ id: 1, a: 1, b: false },
{ id: 2, a: 2, b: { c: { d: 4 } } },
{ id: 3, a: 1, b: { c: 1 } }
], (err, keys) => {
expect(err).to.not.exist();
db.test.query({ b: { c: { d: 4 } } }, (err, result) => {
expect(err).to.not.exist();
expect(result).to.deep.equal([{ id: 2, a: 2, b: { c: { d: 4 } } }]);
done();
});
});
});
});
});

@@ -390,0 +434,0 @@

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