添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Repository files navigation

chance-object

A Chance.js mixin to generate objects.

Install

$ npm i chance-object
$ 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