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

Feat (useArrayUnique): Custom deduplication #2610

Closed

Conversation

bpolaszek
Copy link

Description

Hey there, thanks @Alfred-Skyblue for the #2597 contribution!

Just adding my 2 cents here with an option to provide a specific property to perform array-of-objects deduplication.

I'm not familiar with Typescript (always used standard Javascript), so I did my best, don't hesitate to point out anything that should be improved.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@Alfred-Skyblue
Copy link
Member

Alfred-Skyblue commented Jan 4, 2023

I think it seems more appropriate to use a custom function here #2612

@bpolaszek
Copy link
Author

bpolaszek commented Jan 4, 2023

More cumbersome to my eyes 😕

While I can understand the need for a custom function (I can add this to the PR if you want), the ability to use a simple string

useArrayUnique(list, 'name')

removes unneeded complexity and improves readability IMHO.

@antfu
Copy link
Member

antfu commented Apr 13, 2023

Close in favor of #2612. Thanks

@antfu antfu closed this Apr 13, 2023
@bpolaszek bpolaszek deleted the feature/custom-deduplication branch April 13, 2023 12:01
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

3 participants