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

ee-orm

Package Overview
Dependencies
Maintainers
2
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ee-orm - npm Package Compare versions

Comparing version 0.3.15 to 0.3.16

3

lib/Model.js

@@ -209,3 +209,5 @@ !function(){

else {
this._deleted = true;
this._fromDb = false;
this.emit('delete', this);
callback(null, this);

@@ -230,3 +232,2 @@ }

, filter : {}
, limit : 1
};

@@ -233,0 +234,0 @@

@@ -293,4 +293,4 @@ !function(){

else {
if (this._isCorrectType(item)){
proto.push.call(this, item);
if (this._isCorrectType(item)) {
this._protoPush(item);
if (callback) callback(null, this.length);

@@ -318,3 +318,3 @@ }

, removedItems = proto.splice.call(this, index, howMany)
, callback = arg(arguments, 'function');
, callback = new Arguments(arguments).getFunction();

@@ -409,3 +409,3 @@ // remove the callback if present

else if (unshift) proto.unshift.call(this, model);
else proto.push.call(this, model);
else this._protoPush(model);
}

@@ -427,6 +427,15 @@ else {

this._originalRecords.push(item);
proto.push.call(this, item);
this._protoPush(item);
}}
, _protoPush: { value: function(item){
item.on('delete', function(){
var idx = this.indexOf(item);
if (idx >= 0) this.splice(idx, 1);
}.bind(this));
proto.push.call(this, item);
}}
// check if a model is typeof this

@@ -451,8 +460,3 @@ , _isCorrectType: { value: function(model){

, unshift: { value: function unshift () {
unshift.parent();
}}
// inheriting from the array type, have to implement event by myself

@@ -459,0 +463,0 @@ , _events: {value: {}, writable: true}

{
"name" : "ee-orm"
, "description" : "An easy to use ORM for node.js. Supports eager loading, complex queries, joins, transactions, complex database clusters & connection pooling."
, "version" : "0.3.15"
, "version" : "0.3.16"
, "homepage" : "https://github.com/eventEmitter/ee-orm"

@@ -6,0 +6,0 @@ , "author" : "Michael van der Weg <michael@eventemitter.com> (http://eventemitter.com/)"

@@ -27,6 +27,17 @@

db.event([ORM.count('id', 'eventCount')]).find(cb);
db.event({id:2}, ['*']).fetchImage(['*']).findOne(function(err, evt){
if (err) cb(err);
else {
evt.dir();
evt.image[0].delete(function(err){
if (err) cb(err);
else evt.dir();
});
}
});
return;

@@ -33,0 +44,0 @@

@@ -499,4 +499,4 @@

describe('[Ordering]', function(){

@@ -593,6 +593,44 @@ it('should work :)', function(done){

describe('[Deleting]', function(){
it('A model should be deleted when the delete method is called on it', function(done){
db.event({id:1}).findOne(function(err, evt){
if (err) done(err);
else {
evt.delete(function(err){
if (err) done(err);
else {
db.event({id:1}).findOne(function(err, event){
if (err) done(err);
assert.equal(event, undefined);
done();
});
}
});
}
});
});
it('should remove items from a related set when they are delted', function(done){
db.event({id:2}, ['*']).fetchImage(['*']).findOne(function(err, evt){
if (err) done(err);
else {
evt.image[0].delete(function(err){
if (err) done(err);
else {
assert.equal(JSON.stringify(evt), '{"image":[],"id":2,"title":"Mapping Test","startdate":"1970-01-01T00:00:00.000Z","enddate":null,"canceled":null}');
done();
}
});
}
});
});
});
describe('Connection Pooling', function(){

@@ -599,0 +637,0 @@ it('should be able to insert 1000 items at once', function(done){

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