object-random
v2.1.0
Published
Get random, unique values from an object
Downloads
15
Maintainers
Readme
object-random
Get random, unique values from an object
Install
$ npm install --save object-random
Usage
var objectRandom = require('object-random');
var obj = {
a: 0,
b: 1,
c: 2,
d: 3,
e: 4
};
objectRandom(obj);
//=> [4]
objectRandom(obj, {count: 3});
//=> [0, 3, 2]
objectRandom(object, options)
Returns an array
.
object
Required
Type: object
Object to pick from.
options
Type: object
Options to pass.
count
Type: number
Default: 1
Number of returned values.
License
MIT © Andreas Gillström