Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.1.10 #35

Merged
merged 15 commits into from
Nov 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# Change Log

## [v0.1.9](https://github.com/Cambalab/fake-data-generator/tree/HEAD)
## [v0.1.10](https://github.com/Cambalab/fake-data-generator/tree/v0.1.10) (2019-11-17)
[Full Changelog](https://github.com/Cambalab/fake-data-generator/compare/v0.1.9...v0.1.10)

[Full Changelog](https://github.com/Cambalab/fake-data-generator/compare/v0.1.8...HEAD)
**Merged pull requests:**

- 0.1.9 [\#34](https://github.com/Cambalab/fake-data-generator/pull/34) ([sgobotta](https://github.com/sgobotta))

## [v0.1.9](https://github.com/Cambalab/fake-data-generator/tree/v0.1.9) (2019-11-17)
[Full Changelog](https://github.com/Cambalab/fake-data-generator/compare/v0.1.8...v0.1.9)

**Implemented enhancements:**

Expand All @@ -14,6 +20,7 @@
**Merged pull requests:**

- Removes constants config file [\#31](https://github.com/Cambalab/fake-data-generator/pull/31) ([sgobotta](https://github.com/sgobotta))
- 0.1.8 [\#29](https://github.com/Cambalab/fake-data-generator/pull/29) ([sgobotta](https://github.com/sgobotta))

## [v0.1.8](https://github.com/Cambalab/fake-data-generator/tree/v0.1.8) (2019-10-25)
[Full Changelog](https://github.com/Cambalab/fake-data-generator/compare/v0.1.7...v0.1.8)
Expand Down
39 changes: 29 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,48 @@

### Usage as an npm dependency

#### 1. Write a simple JSON model as explained before
#### 1. Write a simple model as explained before, as a JSON or as a Javascript Object

#### 2. Use it in your own module

**amountArg:**
+ **Type:** `Number`
+ **Description:** describes how many elements should be created from a given model
+ **Required**

**modelArg:**
+ **Type:** `Object | Json file`
+ **Description:** when **inputType** param is `json`, **modelArg** behaves as a file path to that json file. For `object` **inputType** values, **modelArg** behaves like a javascript object, where the model should be defined.
+ **Required**

**fileName:**
+ **Type:** `String`
+ **Description** when **inputType** is `json` **fileName** will describe the output path where the file will be writen to.

**inputType:**
+ **Type:** `String`
+ **Options:** `object | json`
+ **Description:** describes the kind of input the generator will receive and read the model from.

**outputType:**
+ **Type:** `String`
+ **Options:** `object | json`
+ **Description:** describes the kind of output the generator will write or return.

```javascript
// Requires the package
const { generateModel } = require('fake-data-generator')
// Requires a model
const model = require('./models/example.json')
// Generate the model
const amountArg = 50
const modelArg = 'example'
const modelArg = model
const inputType = 'object'
const outputType = 'object'
const generatedModel = generateModel({ amountArg, modelArg, outputType })
const generatedModel = generateModel({ amountArg, modelArg, inputType, outputType })
```
> Note that using **required** or **import** on a `.json` file, the returned value behaves like a javascript Object.

#### generateModel function

* **amountArg:** *the quantity of models to generate*
* **modelArg:** *the name of your model in the models directory*
* **outputType:** *one of the following:*
+ **object:** *Returns a javascript object or array*
+ **json:** *Outputs a json file to the output directory*

### Usage as a global npm dependency

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@
"release:patch": "npm version patch && npm publish",
"test:unit": "npm run build && ./node_modules/.bin/mocha -R spec ./dist/test/**"
},
"version": "0.1.9"
"version": "0.1.10"
}