Mimic sample data.
See Functions
const mimic = require('mimeo-js').mimic;
const sampleData = {
name: 'John Doe',
gender: (chance) => chance.pickone(['male','female']);
}
console.log(mimic(sampleData)); // Different each time
console.log(mimic(sampleData, true)); // Will always be same whenever ran
console.log(mimic(sampleData, {seed: 'someSeed')); // Will always be same whenever ran using same seed
The data to be mimicked. Tries to get an approximately similar data item.
Objects have each key recursively called.
If the data value is a function, it is called with one parameter, a chance instance. The mimicked value will be the return value of the function:
Is either a boolean (shouldSeed) or an object(generatorOpts). See below.
You can get repeatable values by passing
true
as the second parameter of themimic
function{ seed {any}: The seed that will be used. }