Socket
Socket
Sign inDemoInstall

random-text-copies

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    random-text-copies

Randomly pick a element from an array of objects by a weight callback


Version published
Weekly downloads
2
decreased by-50%
Maintainers
1
Install size
9.87 kB
Created
Weekly downloads
 

Readme

Source

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

FAQs

Last updated on 20 May 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc