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

Add isSubsetByComparator JavaScript array function #1489

Closed

Conversation

GrayedFox
Copy link

This pull request adds a JavaScript array method called isSubsetByComparator which evaluates if an array is a subset of another array using a comparator function.

Happy hacktoberfest and keep up the good work 👍🏾

Copy link
Owner

@Chalarangelo Chalarangelo left a comment

Choose a reason for hiding this comment

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

Thanks for contributing, but this is a duplicate of isContainedIn.

@GrayedFox
Copy link
Author

GrayedFox commented Oct 11, 2020

Hmm, it is true that this method achieves the same result but only when the comparator function looks for an exact match.

This method has added functionality in that when calling the method the user gets to define the match (as opposed to it being a direct match). This function can therefore be used to define the matching behaviour, which is not possible with the isContainedIn() function. See the second example:

isSubsetByComparator((x, y) => x * 2 === y, [1, 3, 5], [2, 4, 6, 8, 10]); // 'true'

@Chalarangelo would you mind taking another look at this PR? I understand it's a busy time for all of you maintainers, considering it's Hacktoberfest, so I don't mean to be pushy or anything.

I might be mistaken in believing that this is not a true duplicate of isContainedIn. Cheers! 🍺

@GrayedFox
Copy link
Author

@Trinityyi any chance of getting a 2nd pair of eyes on this? Thank you! 🙇🏾‍♀️ 👓

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

Successfully merging this pull request may close these issues.

None yet

2 participants