Skip to content

Commit

Permalink
Merge branch 'method-chain' from akre54/method-chain
Browse files Browse the repository at this point in the history
  • Loading branch information
akre54 committed May 27, 2014
2 parents af0a76b + ce67808 commit c33dcde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@
});

// Underscore methods that we want to implement on the Model.
var modelMethods = ['keys', 'values', 'pairs', 'invert', 'pick', 'omit'];
var modelMethods = ['keys', 'values', 'pairs', 'invert', 'pick', 'omit', 'chain'];

// Mix in each Underscore method as a proxy to `Model#attributes`.
_.each(modelMethods, function(method) {
Expand Down
5 changes: 5 additions & 0 deletions test/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@
deepEqual(model.omit('foo', 'bar'), {'baz': 'c'});
});

test("chain", function() {
var model = new Backbone.Model({ a: 0, b: 1, c: 2 });
deepEqual(model.chain().pick("a", "b", "c").values().compact().value(), [1, 2]);
});

test("clone", 10, function() {
var a = new Backbone.Model({ 'foo': 1, 'bar': 2, 'baz': 3});
var b = a.clone();
Expand Down

0 comments on commit c33dcde

Please sign in to comment.