mocker-data-generator
Advanced tools
Comparing version
@@ -10,4 +10,5 @@ "use strict"; | ||
tslib_1.__exportStar(require("./lib/Generator"), exports); | ||
exports.mocker = function (opts) { return new Mocker_1.Mocker(opts); }; | ||
var mocker = function (opts) { return new Mocker_1.Mocker(opts); }; | ||
exports.mocker = mocker; | ||
exports.default = exports.mocker; | ||
//# sourceMappingURL=index.js.map |
@@ -111,3 +111,3 @@ "use strict"; | ||
ava_1.default('Test all fakerJS locales', function (t) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { | ||
var supportedLocales; | ||
var supportedLocales, loc; | ||
return tslib_1.__generator(this, function (_a) { | ||
@@ -117,3 +117,7 @@ supportedLocales = Object.keys(fakerJS.locales); | ||
supportedLocales.forEach(function (locale) { | ||
var res = gen.faker({ faker: 'address.streetAddress', locale: locale }); | ||
loc = locale; | ||
var res = gen.faker({ | ||
faker: 'address.streetAddress', | ||
locale: locale | ||
}); | ||
t.true(typeof res === 'string'); | ||
@@ -124,3 +128,3 @@ }); | ||
console.log(e); | ||
console.log('Pull request maded to fakerJS repo.'); | ||
console.log("Locale \"" + loc + "\" doesnt have address..."); | ||
} | ||
@@ -127,0 +131,0 @@ return [2 /*return*/]; |
@@ -5,13 +5,16 @@ "use strict"; | ||
var tslib_1 = require("tslib"); | ||
exports.isArray = function (arg) { | ||
var isArray = function (arg) { | ||
return Object.prototype.toString.call(arg) === '[object Array]'; | ||
}; | ||
exports.isObject = function (arg) { | ||
exports.isArray = isArray; | ||
var isObject = function (arg) { | ||
return Object.prototype.toString.call(arg) === '[object Object]'; | ||
}; | ||
exports.evalWithContextData = function (key, object, db) { | ||
exports.isObject = isObject; | ||
var evalWithContextData = function (key, object, db) { | ||
// In this (way, we can pass object and use inside the eval string | ||
return eval(key); | ||
}; | ||
exports.fieldArrayCalcLength = function (config, fixedArrayLength, schema) { | ||
exports.evalWithContextData = evalWithContextData; | ||
var fieldArrayCalcLength = function (config, fixedArrayLength, schema) { | ||
var length; | ||
@@ -29,3 +32,4 @@ if (typeof config.length === 'function') { | ||
}; | ||
exports.iamLastChild = function (parent, k) { | ||
exports.fieldArrayCalcLength = fieldArrayCalcLength; | ||
var iamLastChild = function (parent, k) { | ||
if (exports.isArray(parent[k])) { | ||
@@ -49,3 +53,4 @@ var last = false; | ||
}; | ||
exports.iamLastParent = function (obj) { | ||
exports.iamLastChild = iamLastChild; | ||
var iamLastParent = function (obj) { | ||
var last = false; | ||
@@ -67,7 +72,9 @@ if (exports.isObject(obj)) { | ||
}; | ||
exports.isConditional = function (str) { | ||
exports.iamLastParent = iamLastParent; | ||
var isConditional = function (str) { | ||
var arr = str.split(','); | ||
return arr.length > 1; | ||
}; | ||
exports.cleanVirtuals = function (paths, object, options) { | ||
exports.isConditional = isConditional; | ||
var cleanVirtuals = function (paths, object, options) { | ||
// clean specific paths | ||
@@ -167,3 +174,4 @@ var objectCleaner = function (path, obj, options) { | ||
}; | ||
exports.fnParser = function (name, fn, cfg) { | ||
exports.cleanVirtuals = cleanVirtuals; | ||
var fnParser = function (name, fn, cfg) { | ||
var _a = cfg.split('('), body = _a[0], args = _a[1]; | ||
@@ -207,3 +215,4 @@ body = body.split('.'); | ||
}; | ||
exports.loopInside = function (object, path) { | ||
exports.fnParser = fnParser; | ||
var loopInside = function (object, path) { | ||
var p = path.split('.'); | ||
@@ -217,2 +226,3 @@ return p.reduce(function (acc, val) { | ||
}; | ||
exports.loopInside = loopInside; | ||
//# sourceMappingURL=utils.js.map |
@@ -5,28 +5,36 @@ # Changelog | ||
## [2.12.0](https://github.com/danibram/mocker-data-generator/compare/v2.10.0...v2.12.0) (2021-02-03) | ||
### Features | ||
- **chore:** updated deps | ||
## [2.10.0](https://github.com/danibram/mocker-data-generator/compare/v2.9.0...v2.10.0) (2020-10-13) | ||
### Features | ||
- Merged Array Example: [#102](https://github.com/danibram/mocker-data-generator/pull/102) | ||
- Merged Generic Type for Generator: [#114](https://github.com/danibram/mocker-data-generator/pull/114) | ||
## [2.9.0](https://github.com/danibram/mocker-data-generator/compare/v2.8.0...v2.9.0) (2020-09-04) | ||
### Features | ||
* add buildSync method to Mocker class ([772b20d](https://github.com/danibram/mocker-data-generator/commit/772b20da6f9ccaba98f20a1361babe5f55810d78)) | ||
* all deps updated!! | ||
- add buildSync method to Mocker class ([772b20d](https://github.com/danibram/mocker-data-generator/commit/772b20da6f9ccaba98f20a1361babe5f55810d78)) | ||
- all deps updated!! | ||
### Bug Fixes | ||
* **appveyor:** update matrix config to install defined node version ([703aa41](https://github.com/danibram/mocker-data-generator/commit/703aa41411b3813f3d1af6e79b6d2643a36dec56)) | ||
* **docs-website:** added seed example ([d1fa143](https://github.com/danibram/mocker-data-generator/commit/d1fa143f20467cf69c87e5cc4a74657429550384)) | ||
- **appveyor:** update matrix config to install defined node version ([703aa41](https://github.com/danibram/mocker-data-generator/commit/703aa41411b3813f3d1af6e79b6d2643a36dec56)) | ||
- **docs-website:** added seed example ([d1fa143](https://github.com/danibram/mocker-data-generator/commit/d1fa143f20467cf69c87e5cc4a74657429550384)) | ||
## [2.8.0](https://github.com/danibram/mocker-data-generator/compare/v2.7.0...v2.8.0) (2020-05-13) | ||
### Features | ||
* **chore:** easy publish as minor shortcut ([fd1a87b](https://github.com/danibram/mocker-data-generator/commit/fd1a87bfe444817b75af88c91398929fab91b83c)) | ||
* **chore:** update chance and tslib, and some devDependencies ([59d0aea](https://github.com/danibram/mocker-data-generator/commit/59d0aea51fba7ef2e6b1ea153da4aa8007f07170)) | ||
* **Mocker.seed:** add posibility to prepopulate the db. Thanks [@suspiciousfellow](https://github.com/suspiciousfellow) and [@marshallswain](https://github.com/marshallswain) for the idea and the code ([dfb2ad6](https://github.com/danibram/mocker-data-generator/commit/dfb2ad64fe002e4b55dfe71d1d65574d5054d6cc)) | ||
* **Mocker.seed:** add tests ([7faafab](https://github.com/danibram/mocker-data-generator/commit/7faafab779af49434c47ac63631aea9cebbc9be7)) | ||
* **Mocker.seed:** seed and schema and work together ([68970fc](https://github.com/danibram/mocker-data-generator/commit/68970fc3fe7a2072c99d58ed3b1ececd3b6909dd)) | ||
- **chore:** easy publish as minor shortcut ([fd1a87b](https://github.com/danibram/mocker-data-generator/commit/fd1a87bfe444817b75af88c91398929fab91b83c)) | ||
- **chore:** update chance and tslib, and some devDependencies ([59d0aea](https://github.com/danibram/mocker-data-generator/commit/59d0aea51fba7ef2e6b1ea153da4aa8007f07170)) | ||
- **Mocker.seed:** add posibility to prepopulate the db. Thanks [@suspiciousfellow](https://github.com/suspiciousfellow) and [@marshallswain](https://github.com/marshallswain) for the idea and the code ([dfb2ad6](https://github.com/danibram/mocker-data-generator/commit/dfb2ad64fe002e4b55dfe71d1d65574d5054d6cc)) | ||
- **Mocker.seed:** add tests ([7faafab](https://github.com/danibram/mocker-data-generator/commit/7faafab779af49434c47ac63631aea9cebbc9be7)) | ||
- **Mocker.seed:** seed and schema and work together ([68970fc](https://github.com/danibram/mocker-data-generator/commit/68970fc3fe7a2072c99d58ed3b1ececd3b6909dd)) | ||
@@ -33,0 +41,0 @@ ## [2.7.0](https://github.com/danibram/mocker-data-generator/compare/v2.6.5...v2.7.0) (2020-04-16) |
{ | ||
"name": "mocker-data-generator", | ||
"version": "2.10.0", | ||
"version": "2.12.0", | ||
"description": "A simplified way to generate mock data, builds using a simple schema and with the FakerJs", | ||
@@ -89,7 +89,7 @@ "main": "build/main/index.js", | ||
"devDependencies": { | ||
"@types/chance": "^1.1.0", | ||
"@types/faker": "^4.1.12", | ||
"@types/node": "^14.6.4", | ||
"ava": "^3.12.1", | ||
"codecov": "^3.7.2", | ||
"@types/chance": "^1.1.1", | ||
"@types/faker": "^5.1.6", | ||
"@types/node": "^14.14.22", | ||
"ava": "^3.15.0", | ||
"codecov": "^3.8.1", | ||
"conventional-github-releaser": "^3.1.5", | ||
@@ -102,10 +102,10 @@ "gh-pages": "^3.1.0", | ||
"opn-cli": "^5.0.0", | ||
"prettier": "^2.1.1", | ||
"standard-version": "^9.0.0", | ||
"trash-cli": "^3.1.0", | ||
"ts-node": "^9.0.0", | ||
"prettier": "^2.2.1", | ||
"standard-version": "^9.1.0", | ||
"trash-cli": "^4.0.0", | ||
"ts-node": "^9.1.1", | ||
"tslint": "^6.1.3", | ||
"tslint-config-standard": "^9.0.0", | ||
"typedoc": "^0.19.0", | ||
"typescript": "^4.0.2" | ||
"typedoc": "^0.20.20", | ||
"typescript": "^4.1.3" | ||
}, | ||
@@ -115,5 +115,5 @@ "dependencies": { | ||
"chance": "^1.1.7", | ||
"faker": "^5.1.0", | ||
"faker": "^5.3.1", | ||
"randexp": "^0.5.3", | ||
"tslib": "^2.0.1" | ||
"tslib": "^2.1.0" | ||
}, | ||
@@ -120,0 +120,0 @@ "nyc": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
261084
0.43%3437
0.44%Updated
Updated