2.1.0 • Published 9 years ago

object-random v2.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

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