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

Feature Request - Iteratee for difference / union / without #2427

Closed
hunterSThompson opened this issue Jan 25, 2016 · 3 comments
Closed

Feature Request - Iteratee for difference / union / without #2427

hunterSThompson opened this issue Jan 25, 2016 · 3 comments

Comments

@hunterSThompson
Copy link

It would be cool to be able to override default with an iteratee in difference, set, and the other set operations in Underscore.

For example:

var obj1 = {id: 1, name: "John"};
var obj2 = {id: 2, name: "Bob"};
var obj3 = {id: 3, name: "Steve"};

var list1 = [obj1, obj2, obj3];
var list2 = [obj1, obj2];

var difference = _.difference(list1, list2, function(x, y) { return x.Id == y.Id });
// difference -> [obj3]

Would this be useful to anyone else? Can start working on a patch if so.

@akre54
Copy link
Collaborator

akre54 commented Feb 10, 2016

This seems like it'd be useful. Send that patch!

@jdalton
Copy link
Contributor

jdalton commented Feb 10, 2016

There's a lot of discussion on #2311 around this kind of thing. Dup of #2311.

@binarykitchen
Copy link

Me too would welcome this feature. Looking at the long thread in #2311 doesnt help. Can't someone summarize the solution here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants