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

downstairs

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

downstairs - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

12

lib/table.js

@@ -15,4 +15,12 @@ var Table = {}

for (var key in conditions){
var clause = Model.sql[key].equals(conditions[key]);
clauses.push(clause);
if (Model.sql[key]) {
if (conditions[key]) {
var clause = Model.sql[key].equals(conditions[key]);
clauses.push(clause);
}
else {
var clause = Model.sql[key].isNull();
clauses.push(clause);
}
}
}

@@ -19,0 +27,0 @@

2

package.json
{
"name": "downstairs",
"description": "A light ORM wrapped about brianc's node-sql and node-pg",
"version": "0.2.1",
"version": "0.2.2",
"homepage": "https://github.com/moneytribeaustralia/downstairs.js",

@@ -6,0 +6,0 @@ "author": {

@@ -44,4 +44,4 @@ var pg = require('pg')

, 'updated_at'
, 'is_active'
, 'email'
, 'null_field'
, 'password'

@@ -58,2 +58,3 @@ ]

email character varying(512) unique,\
null_field character varying(50),\
password character varying(512), \

@@ -60,0 +61,0 @@ CONSTRAINT pk_users PRIMARY KEY (id)\

@@ -23,2 +23,3 @@ var Downstairs = require('../lib/downstairs')

, 'email'
//, 'null_field'
, 'password'

@@ -36,4 +37,3 @@ ]

describe('Tables creating Model constructors', function(){
describe('Tables creating Model constructors', function(done){
it('returns a Model (a constructor function), with a mappings property', function(){

@@ -73,3 +73,3 @@ var User = Table.model('User', userSQL);

User.find({username: 'fred', email: 'fred@moneytribe.com.au'} , function(err, user){
User.find({ username: 'fred', email: 'fred@moneytribe.com.au' } , function(err, user){
should.exist(user);

@@ -82,2 +82,15 @@ user.username.should.equal('fred');

it('finds a record with a where JSON condition including a null field', function(done) {
var User = Table.model('User', userSQL);
var data = {password: '5f4dcc3b5aa765d61d8327deb882cf99', username: 'fred', email: 'fred@moneytribe.com.au' };
ectypes.User.create(data, function(err, results) {
User.find({ username: 'fred', null_field: null } , function(err, user){
should.exist(user);
user.username.should.equal('fred');
done();
});
});
});
it('finds all records with an empty object JSON condition', function(done) {

@@ -84,0 +97,0 @@ var User = Table.model('User', userSQL);

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