randray
v2.0.0
Published
Get a random item from an array
Downloads
4
Readme
randray
Get a random item from an array
Note: randray
is only supported on iojs and node v4+. To use with an older
version of node, please use randray@1
.
Install
$ npm install --save randray
API
var randray = require('randray')
// not an array will throw
randray(true)
// empty array will return null
randray([])
// => null
randray([1, 2, 3, 4])
// => 2
Test
$ npm test
Coverage
$ npm test -- --cov
Author
Evan Lucas
License
MIT (See LICENSE
for more info)