diff --git a/CHANGELOG.md b/CHANGELOG.md index b1b0eaa..826d936 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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:** @@ -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) diff --git a/README.md b/README.md index 466a93b..37f59c5 100644 --- a/README.md +++ b/README.md @@ -60,10 +60,34 @@ ### 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') @@ -71,18 +95,13 @@ 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 diff --git a/package-lock.json b/package-lock.json index a1082fc..30bebbb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "fake-data-generator", - "version": "0.1.9", + "version": "0.1.10", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4b47fe4..56e2258 100644 --- a/package.json +++ b/package.json @@ -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" }