@nasirbaloch/shuffler
v1.1.3
Published
This is the package for any kind of array shuffle and after shuffle it will provide you an random item of that array.
Downloads
9
Maintainers
Readme
shuffler-package
This is the package for any kinds of array shuffler and get a random item of an array.
How to use?
Simply import like this. import shuffle from '@nasirbaloch/shuffler';
then place any kind of array in this. For example.
import shuffle from '@nasirbaloch/shuffler';
array1 = [1, 2, 3, 4, 5]
array2 = ["john doe", "robin", "alexa", "google"];
array3 = [
{
"name": "john",
"age" : 20
},
{
"name": "robin",
"age" : 30
},
{
"name": "alexa",
"age" : 05
},
]
etc....
//this could be any array. then simple pass array in function. like this.
shuffle(definedArray);
// it will return you the shuffled item, you can receive in any variable. And then simply console log that variable.
Thanks 😍