object-random

2.1.0 • Public • Published

object-random Build Status

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

Package Sidebar

Install

npm i object-random

Weekly Downloads

2

Version

2.1.0

License

MIT

Last publish

Collaborators

  • gillstrom