From b93030b0d89cb78ff4c9d6a3535e40d657fc4519 Mon Sep 17 00:00:00 2001 From: Graeme Yeates Date: Fri, 3 Oct 2014 00:21:05 -0400 Subject: [PATCH] Use matches in .where --- backbone.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/backbone.js b/backbone.js index 453f888c..e93e67a2 100644 --- a/backbone.js +++ b/backbone.js @@ -833,12 +833,9 @@ // Return models with matching attributes. Useful for simple cases of // `filter`. where: function(attrs, first) { - if (_.isEmpty(attrs)) return first ? void 0 : []; + var matches = _.matches(attrs); return this[first ? 'find' : 'filter'](function(model) { - for (var key in attrs) { - if (attrs[key] !== model.get(key)) return false; - } - return true; + return matches(model.attributes); }); },