Nitrogenous Polymorphic Molecule
    Have ideas to improve npm?Join in the discussion! »

    random-text-copies
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    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')
     

    Keywords

    Install

    npm i random-text-copies

    DownloadsWeekly Downloads

    0

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    10.1 kB

    Total Files

    8

    Last publish

    Collaborators

    • avatar