Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manovotny/chance-object
A Chance.js mixin to generate objects.
https://github.com/manovotny/chance-object
chance chancejs mixin object
Last synced: 12 days ago
JSON representation
A Chance.js mixin to generate objects.
- Host: GitHub
- URL: https://github.com/manovotny/chance-object
- Owner: manovotny
- License: mit
- Created: 2017-07-25T20:51:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-08T22:07:28.000Z (over 5 years ago)
- Last Synced: 2024-12-02T15:42:56.217Z (20 days ago)
- Topics: chance, chancejs, mixin, object
- Language: JavaScript
- Homepage:
- Size: 62.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chance-object
> A [Chance.js mixin](http://chancejs.com/#mixin) to generate objects.
## Install
### NPM
```
$ npm i chance-object
```### Yarn
```
$ yarn add chance-object
```## Usage
```js
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:
```js
{
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:
```js
chance.object({
key: 'value'
});
```Result:
```js
{
randomKey: 'randomValue',
key: 'value'
}
```## License
MIT © [Michael Novotny](https://manovotny.com)