-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
Getting unique values when specifying length #220
Comments
Hi @juliendelort , I have a doubt in this implementation.
Either way, the function is not returning an output which is compliant to the specified input options |
That makes sense, thank you for the reply! // Returns 10 items for sure with possible duplicates (duplicates only if there are less than 10 entries in the data)
randCat({ tryUniques: 10, priority: 'length' });
// If there are less than 10 entries in the data, the below would just return all the data entries (less than 10)
randCat({ tryUniques: 10, priority: 'unicity' }); (Different option names can be used) |
@shaharkazaz @theryansmee any thoughts? |
I really like the idea of ensuring data is unique, and I think the We need to think about:
All that said, i've already run into issues in my unit tests with duplicated data being returned from Falso, so this would be a blessing for me 😂 |
@shaharkazaz @NetanelBasal - Did you guys have any more thoughts on this? The more I think about it, the more I think it would be cool |
I'm ok with the proposed API. It should be easy because we have the proxy function. |
I'm going to have a little crack at it then :) |
Allow user to set length priority to length or unique (POC) ✅ Closes: #220
Move randUniqueElement logic into fakFromArray. Simplified fakeFromFunction while loop logic #220
Add default comparison functions for most likely use cases. Implimented them ✅ Closes: #220
Add comparison function and start change over to using it ✅ Closes: #220
Fix snapshot error. Ensure all thrown errors throw actual errors rather than strings ✅ Closes: #220
Add missing priority doc comment ✅ Closes: #220
Move validators to own file. Rename validators to follow similar naming convention ✅ Closes: #220
(Still need to do tests for objectIsUnique) ✅ Closes: #220
Any ETA for this feature to be implemented? |
It depends on @theryansmee :) |
Hi. Sorry, i've not looked at this in months. Last time I looked there was a butt load of merge conflicts with my PR and I haven't had any time to solve them. I will try and see if I can get them fixed this week so we can finally get this work in. Sorry again for the radio silence |
Hello, any chance of giving this one some new love? I see a lot of effort has been done on the PR last year by @theryansmee , would be a shame to waste that i.m.o. Anything I can do to help? |
@kfrederix yes, I'll take a look at it this week 👍 |
Hopefully we can close this, it would really come in handy! |
+1 |
Description
Currently, when specifying a length, duplicates can be returned.
Here is an example call:
result:
Is there a way to only get unique results?
Proposed solution
Maybe an extra option:
Alternatives considered
No response
Do you want to create a pull request?
No
The text was updated successfully, but these errors were encountered: