ampersand-collection
Advanced tools
Comparing version 1.3.16 to 1.3.17
@@ -81,3 +81,3 @@ var BackboneEvents = require('backbone-events-standalone'); | ||
} else { | ||
id = attrs[targetProto.idAttribute || 'id']; | ||
id = attrs[targetProto.idAttribute || this.mainIndex]; | ||
} | ||
@@ -84,0 +84,0 @@ |
{ | ||
"name": "ampersand-collection", | ||
"version": "1.3.16", | ||
"version": "1.3.17", | ||
"author": "Henrik Joreteg <henrik@andyet.net>", | ||
@@ -5,0 +5,0 @@ "bugs": { |
@@ -325,3 +325,3 @@ # ampersand-collection | ||
Unlike a backbone collection it does not include underscore and all the array methods from underscore, though if you wish more functions than those built into modern browsers, you can mixin [ampersand-collection-underscore-mixin](#ampersand-collection-underscore-mixin) to get them. | ||
Unlike a backbone collection it does not include underscore and all the array methods from underscore, though if you wish more functions than those built into modern browsers, you can mixin [ampersand-collection-underscore-mixin](https://github.com/AmpersandJS/ampersand-collection-underscore-mixin) to get them. | ||
@@ -328,0 +328,0 @@ ```javascript |
@@ -287,2 +287,14 @@ var test = require('tape'); | ||
test('Should prevent duplicate items when using non-standard mainIndex without model', function (t) { | ||
var C = Collection.extend({ | ||
mainIndex: '_id' | ||
}); | ||
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'); | ||
t.end(); | ||
}); | ||
test('Bug 20. Should prevent duplicate items when using non-standard idAttribute', function (t) { | ||
@@ -289,0 +301,0 @@ var data = [{_id: '2'}]; |
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
40111
634