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

ampersand-collection

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampersand-collection - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

12

ampersand-collection.js

@@ -146,3 +146,7 @@ var BackboneEvents = require('backbone-events-standalone');

model = toAdd[i];
if (model.trigger) model.trigger('add', model, this, options);
if (model.trigger) {
model.trigger('add', model, this, options);
} else {
this.trigger('add', model, this, options);
}
}

@@ -181,3 +185,7 @@ if (sort || (order && order.length)) this.trigger('sort', this, options);

options.index = index;
if (model.trigger) model.trigger('remove', model, this, options);
if (model.trigger) {
model.trigger('remove', model, this, options);
} else {
this.trigger('remove', model, this, options);
}
}

@@ -184,0 +192,0 @@ this._removeReference(model, options);

2

package.json
{
"name": "ampersand-collection",
"version": "1.3.2",
"version": "1.3.3",
"author": "Henrik Joreteg <henrik@andyet.net>",

@@ -5,0 +5,0 @@ "bugs": {

@@ -243,1 +243,22 @@ var test = require('tape');

});
test('add/remove events should be triggerd with POJO collections', function (t) {
t.plan(4);
var c = new Collection();
var newModel = { id: 1, foo: 'bar' };
c.once('add', function (model, collection, options) {
t.equal(model, newModel);
t.equal(collection, c);
});
c.add(newModel);
c.once('remove', function (model, collection, options) {
t.equal(model.id, 1);
t.equal(collection, c);
});
c.remove(newModel);
});
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