[Pkg-javascript-commits] [backbone] 25/34: Added Backbone.Collection.toJSON. Returns array of model's toJSON

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 16:58:54 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.2.0
in repository backbone.

commit 89e7e6767f006fc214487def7a0c286ed44c2090
Author: Chris Pickett <cpickett at zodas.com>
Date:   Wed Oct 20 15:28:47 2010 -0400

    Added Backbone.Collection.toJSON. Returns array of model's toJSON
---
 backbone.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/backbone.js b/backbone.js
index d53e3f5..19e845e 100644
--- a/backbone.js
+++ b/backbone.js
@@ -329,6 +329,11 @@
     // The default model for a collection is just a **Backbone.Model**.
     // This should be overridden in most cases.
     model : Backbone.Model,
+    
+    // Return a array containing each model's toJSON result.
+    toJSON : function() {
+      return this.models.map(function(model){ return model.toJSON(); })
+    },
 
     // Add a model, or list of models to the set. Pass **silent** to avoid
     // firing the `added` event for every new model.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git



More information about the Pkg-javascript-commits mailing list