Download:
child 2:e1d4f3c5b403
parent 0:61173cbe6827
1:953d380d3035
Anton Shestakov <engored@ya.ru>, Wed, 05 Dec 2012 01:27:51 +0900
Add pluck() and chain() to Shard.

1 файлов изменено, 9 вставок(+), 1 удалений(-) [+]
backbone.shard.js file | annotate | diff | comparison | revisions
--- a/backbone.shard.js Wed Dec 05 00:36:27 2012 +0900
+++ b/backbone.shard.js Wed Dec 05 01:27:51 2012 +0900
@@ -41,7 +41,15 @@
};
_.extend(Backbone.Shard.prototype, Backbone.Events, {
- initialize: function() {}
+ initialize: function() {},
+
+ pluck: function(attr) {
+ return _.map(this.models, function(model) { return model.get(attr); });
+ },
+
+ chain: function () {
+ return _(this.models).chain();
+ }
});
// Underscore methods that we want to implement on the Shard.