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

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i object-random

    Weekly Downloads

    15

    Version

    2.1.0

    License

    MIT

    Last publish

    Collaborators

    • gillstrom