Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

chance-object

1.0.1 • Public • Published

chance-object Build Status

A Chance.js mixin to generate objects.

Install

NPM

$ npm i chance-object

Yarn

$ yarn add chance-object

Usage

import Chance from 'chance';
import object from 'chance-object';
 
const chance = new Chance();
 
chance.mixin({
    object
});
 
chance.object();

By default, chance-object will return a randomly generated object.

Example:

{
    randomKey: 'randomValue';
}

chance-object can also take an optional object as a parameter, which will create a randomly generated object and merge it with the supplied object.

Example:

chance.object({
    key: 'value'
});

Result:

{
    randomKey: 'randomValue',
    key: 'value'
}

License

MIT © Michael Novotny

install

npm i chance-object

Downloadsweekly downloads

51

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability