Created
June 2, 2015 19:44
-
-
Save chiefGui/06ddabb2f666fd9b9508 to your computer and use it in GitHub Desktop.
Implementation of a deep cloning method into a Backbone.Collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Users = Backbone.Collection.extend({ | |
clone: function (deep) { | |
if (deep) { | |
return new this.constructor(_.map(this.models, function (model) { | |
return model.clone(); | |
})); | |
}; | |
return Backbone.Collection.prototype.clone.apply(this); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment