New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ampersand-collection

Package Overview
Dependencies
Maintainers
1
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.1.0 to 1.1.1

12

ampersand-collection.js

@@ -71,4 +71,10 @@ var BackboneEvents = require('backbone-events-standalone');

if (options.parse) attrs = existing.parse(attrs, options);
existing.set(attrs, options);
if (sortable && !sort && existing.hasChanged(sortAttr)) sort = true;
// if this is model
if (existing.set) {
existing.set(attrs, options);
if (sortable && !sort && existing.hasChanged(sortAttr)) sort = true;
} else {
// if not just update the properties
extend(existing, attrs);
}
}

@@ -88,3 +94,3 @@ models[i] = existing;

if (!model) continue;
if (order && (model.isNew() || !modelMap[model.id])) order.push(model);
if (order && ((model.isNew && model.isNew()) || !modelMap[model.id])) order.push(model);
modelMap[model.id] = true;

@@ -91,0 +97,0 @@ }

{
"name": "ampersand-collection",
"version": "1.1.0",
"version": "1.1.1",
"author": "Henrik Joreteg <henrik@andyet.net>",

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

@@ -174,1 +174,13 @@ var test = require('tape');

});
test('`set` method should work for simple objects too', function (t) {
var c = new Collection();
c.set([{id: 'thing'}, {id: 'other'}]);
t.equal(c.length, 2, 'should have two items');
c.set([{id: 'thing', other: 'property'}], {remove: true});
t.equal(c.length, 1, 'should have one item');
var first = c.at(0);
t.equal(first.id, 'thing');
t.equal(first.other, 'property');
t.end();
});
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