-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (29 loc) · 1.37 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const { produce, addProducer } = require("./src/Producer");
const { createContext } = require("./src/Context");
const parameterTokenizer = require("./src/ParameterTokenizer");
// import producers
const { stringProducer } = require("./src/producers/StringProducer");
const { objectProducer } = require("./src/producers/ObjectProducer");
const { arrayProducer } = require("./src/producers/ArrayProducer");
const { booleanProducer } = require("./src/producers/BooleanProducer");
const { numberProducer } = require("./src/producers/NumberProducer");
const { colorProducer } = require("./src/producers/ColorProducer");
const { randomInArrayProducer } = require("./src/producers/RandomInArrayProducer");
const { formatterProducer } = require("./src/producers/FormatterProducer");
// add producers
addProducer("string", stringProducer);
addProducer("object", objectProducer);
addProducer("number", numberProducer);
addProducer("array", arrayProducer);
addProducer("boolean", booleanProducer);
addProducer("color", colorProducer);
addProducer("inArray", randomInArrayProducer);
addProducer("formatter", formatterProducer);
// make fake data and play with it :)
function makefake(dataStructure) {
if (Array.isArray(dataStructure) || dataStructure instanceof RegExp) {
dataStructure = parameterTokenizer(dataStructure);
}
return produce(dataStructure, createContext());
}
module.exports = makefake;