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) { ...@@ -57,6 +57,13 @@ define(function(require) {
57 } 57 }
58 } 58 }
59 }, 59 },
60 iterate: function iterate(obj, callback, context) {
61 if (obj instanceof Model) {
62 obj.each(callback, context);
63 } else if (obj instanceof Collection) {
64 obj.each(callback, context);
65 }
66 },
60 }; 67 };
61 })(Backbone.Model, Backbone.Collection, 'add remove reset sort'); 68 })(Backbone.Model, Backbone.Collection, 'add remove reset sort');
62 return adapter; 69 return adapter;
......