f4048f8f by Adam Heath

Add an iterate() api call, that handles both Model and Collection.

1 parent c4e53ec5
......@@ -57,6 +57,13 @@ define(function(require) {
}
}
},
iterate: function iterate(obj, callback, context) {
if (obj instanceof Model) {
obj.each(callback, context);
} else if (obj instanceof Collection) {
obj.each(callback, context);
}
},
};
})(Backbone.Model, Backbone.Collection, 'add remove reset sort');
return adapter;
......