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 correct handling of non string, number or symbol values to unique #343

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jordydhoker
Copy link

Description

The issue should be clear enough: #342

Checklist

  • Changes are covered by tests if behavior has been changed or added
  • Tests have 100% coverage
  • If code changes were made, the version in package.json has been bumped (matching semver)
  • If code changes were made, the yarn build command has been run and to update the cdn directory
  • If code changes were made, the documentation (in the /docs directory) has been updated

Resolves #342

@vercel
Copy link

vercel bot commented Aug 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
radash-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 21, 2024 2:24am

@sodiray
Copy link
Owner

sodiray commented Feb 21, 2024

Hey @jordydhoker thanks for the PR 👍 I'm curious what your use case is? I'm not sure the ability to use non-primitive values as identifies is worth using a map. I think this change could lead to devs 'shooting themselves in the foot' if they have the ability to use any value for the identity/equality.

aleclarson added a commit to radashi-org/radashi that referenced this pull request Jun 23, 2024
Thanks to @jordydhoker for contributing this test: sodiray/radash#343
aleclarson added a commit to radashi-org/radashi that referenced this pull request Jun 24, 2024
Thanks to @jordydhoker for contributing this test: sodiray/radash#343
aleclarson added a commit to radashi-org/radashi that referenced this pull request Jun 25, 2024
Thanks to @jordydhoker for contributing this test: sodiray/radash#343
aleclarson added a commit to radashi-org/radashi that referenced this pull request Jun 25, 2024
* fix(unique): support any value

…instead of only values that can be identified through a key or can be used as keys themselves.

* test: add a test

Thanks to @jordydhoker for contributing this test: sodiray/radash#343

* fix(unique): skip `reduce` call if `toKey` is not defined

Co-authored-by: jordydhoker <[email protected]>
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.

Unique does not handle non string, number or symbol values correctly
2 participants