mocker-data-generator
Advanced tools
Changelog
(1.0.4)
Changelog
(1.0.3)
Fix Arrays
Breaking Change: the older versions aren´t compatible with this module, the way to generate the data are changed:
var cat = {
name: {
values: ['txuri', 'pitxi', 'kitty']
}
}
var m = mocker()
.schema('cat', cat, 10)
.schema('cat2', cat, { uniqueField: 'name' })
.build(function (data) {
console.log(util.inspect(data, { depth: 10 }))
})
Changelog
(0.7.0)
Breaking Change: Added the posibility to enable the pluralize on the output entity. Now if you want to pluralize the output follow the example in the doc, by defatult is not anymore pluralized.
Old call configuration:
var m = mocker(config)
m.generate('user', 2)
.then(m.generate('group', 2))
.then(m.generate('conditionalField', 2))
.then(function (data) {
console.log(util.inspect(data, { depth: 10 }))
//This returns an object
// {
// user:[array of users],
// group: [array of groups],
// conditionalField: [array of conditionalFields]
// }
})
New array configuration:
var m = mocker(config)
m.generate('user', 2)
.generate('group', 2)
.generate('conditionalField', 2)
.build(function (data) {
console.log(util.inspect(data, { depth: 10 }))
//This returns an object
// {
// user:[array of users],
// group: [array of groups],
// conditionalField: [array of conditionalFields]
// }
})
Changelog
(0.6.0)
Changelog
(0.5.0)
Breaking Change: Break Point with array config. Now is more clear.
Old array configuration:
[{
//Any generator
//Faker
faker: 'random.arrayElement(db.users)[userId]'
//Chance
chance: 'integer'
//Function
function: function (){ return /**/ }
}, //Array config
{length: 10, fixedLength: false}]
New array configuration:
[{
//Any generator
//Faker
faker: 'random.arrayElement(db.users)[userId]'
//Chance
chance: 'integer'
//Function
function: function (){ return /**/ }
//Array config
length: 10,
fixedLength: false
}]