1.0.1 • Published 5 years ago
random-text-copies v1.0.1
random-text-copies
Randomly pick an array item by weight callback
Usage
import rmd from 'random-text-copies'
let items = [
{
name: 'Alex',
weight: 1,
count: 0
},
{
name: 'Jonny',
weight: 2,
count: 0
},
{
name: 'Tom',
weight: 3,
count: 0
}
]
console.log(rmd(items, i => i.weight).name, 'is picked')