Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matches keeps an internal reference to spec object #1730

Merged
merged 2 commits into from
Jul 9, 2014

Conversation

megawac
Copy link
Collaborator

@megawac megawac commented Jul 8, 2014

Fixes #1729

@@ -1178,13 +1178,13 @@

// Returns a predicate for checking whether an object has a given set of `key:value` pairs.
_.matches = function(attrs) {
var keys = _.keys(attrs), length = keys.length;
var pairs = _.pairs(attrs), length = pairs.length;
return function(obj) {
if (obj === attrs) return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How common is obj === attrs really? I assume not so very common so seems like an extraneous check.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's open a separate PR for that.

@michaelficarra
Copy link
Collaborator

LGTM. Thanks.

michaelficarra added a commit that referenced this pull request Jul 9, 2014
Matches keeps an internal reference to spec object
@michaelficarra michaelficarra merged commit 6ff0ecf into jashkenas:master Jul 9, 2014
@megawac megawac deleted the matches branch December 29, 2014 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

_.matches cloning obj.
5 participants