You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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});
The text was updated successfully, but these errors were encountered:
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
I think it would be very useful to add selectiveness and distinctiveness to
pickset
function.Selectiveness by index range is simple using
slice()
function ofArray
object. But, selectiveness by items is not.So, option for exclusion of some items,
exclude
would be convenient.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 likedistinct
would be helpful.The following code could produce array with duplicate values such as
[2, 2]
.The text was updated successfully, but these errors were encountered: