ampersand-collection
Advanced tools
Comparing version 1.3.11 to 1.3.12
@@ -162,3 +162,3 @@ var BackboneEvents = require('backbone-events-standalone'); | ||
var index = this._indexes[indexName || this.mainIndex]; | ||
return index[query] || index[query.id] || this._indexes.cid[query.cid]; | ||
return index[query] || index[query[this.mainIndex]] || this._indexes.cid[query.cid]; | ||
}, | ||
@@ -165,0 +165,0 @@ |
{ | ||
"name": "ampersand-collection", | ||
"version": "1.3.11", | ||
"version": "1.3.12", | ||
"author": "Henrik Joreteg <henrik@andyet.net>", | ||
@@ -5,0 +5,0 @@ "bugs": { |
@@ -264,1 +264,23 @@ var test = require('tape'); | ||
}); | ||
test('Bug 14. Should prevent duplicate items when using non-standard idAttribute', function (t) { | ||
var Model = State.extend({ | ||
idAttribute: '_id', | ||
props: { | ||
_id: 'string' | ||
} | ||
}); | ||
var C = Collection.extend({ | ||
mainIndex: '_id', | ||
model: Model | ||
}); | ||
var c = new C([{_id: '2'}, {_id: '2'}, {_id: '2'}]); | ||
t.equal(c.length, 1, 'should still be 1'); | ||
c.add({_id: '2'}); | ||
t.equal(c.length, 1, 'should still be 1 if added later'); | ||
c.add(new Model({_id: '2'})); | ||
t.equal(c.length, 1, 'should still be 1 if added as an instantiated model'); | ||
t.end(); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
35697
559
0