Skip to content

Instantly share code, notes, and snippets.

@mhkeller
Last active December 20, 2015 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhkeller/6199130 to your computer and use it in GitHub Desktop.
Save mhkeller/6199130 to your computer and use it in GitHub Desktop.
var collectionFactoryHelpers = {
empty_arr: [],
createCollectionOfModels: function(model, arr_of_objects){
var arr = _.clone(this.empty_arr);
arr_of_objects.forEach( function(item){
arr.push( new model(item) );
});
return arr;
}
};
var ElementCollection = new ElementCollectionPrototype(
collectionFactoryHelpers.createCollectionOfModels(ElementModel, data.account.values)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment