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

Underscore 1.6.0 _.intersection bug (Meteor package) #13001

Closed
alexdorsch opened this issue Feb 9, 2024 · 1 comment · Fixed by #13002
Closed

Underscore 1.6.0 _.intersection bug (Meteor package) #13001

alexdorsch opened this issue Feb 9, 2024 · 1 comment · Fixed by #13002
Labels
Milestone

Comments

@alexdorsch
Copy link

Meteor 2.15 with Underscore 1.6.0

The Meteor version of of the _.intersection function in the underscore package returns unexpected results.

https://github.com/meteor/meteor/blob/master/packages/underscore/underscore.js#L528-L535

In the copy of the function below, _.contains returns boolean, so the >= 0 comparison should be removed:

_.intersection = function(array) {
  var rest = slice.call(arguments, 1);
  return _.filter(_.uniq(array), function(item) {
    return _.every(rest, function(other) {
      return _.contains(other, item) >= 0;
    });
  });
};

Interestingly the v1.6.0 commit in the underscore repo doesn't have this problem:

https://github.com/jashkenas/underscore/blob/1f4bf626f23a99f7a676f5076dc1b1475554c8f7/underscore.js#L506

@StorytellerCZ
Copy link
Collaborator

I must have missed something in my upgrade then.
I'm working on updating to the next version here: #12994

@StorytellerCZ StorytellerCZ linked a pull request Feb 9, 2024 that will close this issue
@StorytellerCZ StorytellerCZ added this to the Release 2.16 milestone Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants