[go: up one dir, main page]

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] exclude and distinct options for pickset() function #495

Open
3rdstage opened this issue Oct 13, 2020 · 0 comments
Open

Comments

@3rdstage
Copy link
3rdstage commented Oct 13, 2020

I think it would be very useful to add selectiveness and distinctiveness to pickset function.

Selectiveness by index range is simple using slice() function of Array object. But, selectiveness by items is not.
So, option for exclusion of some items, exclude would be convenient.

chance.pickset([1, 2, 3, 4, 5], 2, {exclude: [2, 4]});

Currently pickset function select items for the picked array distinctively from the given array. (If the given array has duplicate items at different positions, picked items can be duplicate, of course) But, sometimes it is necessary to pick multiple items allowing duplication (duplicate index, more exactly). So, option like distinct would be helpful.
The following code could produce array with duplicate values such as [2, 2].

chance.pickset([1, 2, ,3, 4, 5], 2, {distinct: false}); 
@3rdstage 3rdstage changed the title [Feature Request] exceptions and distictive options for pickset function [Feature Request] exclude and distinct options for pickset() function Oct 13, 2020
ahhadian added a commit to IRIL-Webelopers/chancejs that referenced this issue Dec 21, 2020
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

No branches or pull requests

1 participant