Skip to content

Commit def6908

Browse files
author
Vlad Balin
committed
hotfix for collection bug
1 parent 8bef668 commit def6908

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

nestedtypes.js

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"LICENSE"
3737
],
3838
"license": "MIT",
39-
"version": "1.1.4",
39+
"version": "1.1.5",
4040
"scripts": {
4141
"test": "node_modules/.bin/mocha",
4242
"build": "./node_modules/.bin/webpack",

src/collection.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,13 @@ module.exports = Backbone.Collection.extend( {
6969

7070
// ATTENTION: Overriden backbone logic with bug fixes
7171
get : function( obj ){
72-
if( obj == null ){
73-
return void 0;
72+
if( obj == null ){ return void 0; }
73+
74+
if( typeof obj === 'object' ){
75+
return this._byId[ obj[ this.model.prototype.idAttribute ] ] || this._byId[ obj.cid ];
7476
}
75-
return typeof obj === 'object' ? this._byId[ obj.id ] || this._byId[ obj.cid ] : this._byId[ obj ];
77+
78+
return this._byId[ obj ];
7679
},
7780

7881
deepClone : function(){ return this.clone( { deep : true } ); },

0 commit comments

Comments
 (0)