random-item
Get a random item from an array
Last updated 6 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install random-item 
SYNC missed versions from official npm registry.

random-item

Get a random item from an array

Install

$ npm install random-item

Usage

import randomItem from 'random-item';

randomItem(['🐴', '🦄', '🌈']);
//=> '🦄'

randomItem.multiple(['🐴', '🦄', '🌈'], 2);
//=> ['🌈', '🦄']

Related

Current Tags

  • 4.0.1                                ...           latest (6 years ago)

6 Versions

  • 4.0.1                                ...           6 years ago
  • 4.0.0                                ...           6 years ago
  • 3.1.0                                ...           6 years ago
  • 3.0.0                                ...           8 years ago
  • 2.0.0                                ...           8 years ago
  • 1.0.0                                ...           11 years ago
Maintainers (1)
Downloads
Total 16
Today 0
This Week 0
This Month 11
Last Day 0
Last Week 9
Last Month 0
Dependencies (0)
None
Dev Dependencies (4)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE