make-mp-data 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +23 -4
- package/package.json +1 -1
- package/utils.js +7 -2
package/index.js
CHANGED
|
@@ -14,12 +14,17 @@ const chance = new Chance();
|
|
|
14
14
|
const { touch, comma, bytesHuman, mkdir } = require("ak-tools");
|
|
15
15
|
const Papa = require("papaparse");
|
|
16
16
|
const {
|
|
17
|
-
integer,
|
|
18
|
-
pick,
|
|
19
17
|
weightedRange,
|
|
18
|
+
pick,
|
|
19
|
+
day,
|
|
20
|
+
integer,
|
|
21
|
+
makeProducts,
|
|
22
|
+
date,
|
|
20
23
|
progress,
|
|
21
24
|
person,
|
|
22
25
|
choose,
|
|
26
|
+
range,
|
|
27
|
+
exhaust,
|
|
23
28
|
openFinder
|
|
24
29
|
} = require("./utils.js");
|
|
25
30
|
const dayjs = require("dayjs");
|
|
@@ -99,7 +104,7 @@ async function main(config) {
|
|
|
99
104
|
chance.normal({ mean: avgEvPerUser, dev: avgEvPerUser / 4 })
|
|
100
105
|
);
|
|
101
106
|
|
|
102
|
-
if (firstEvents) {
|
|
107
|
+
if (firstEvents.length) {
|
|
103
108
|
eventData.push(
|
|
104
109
|
makeEvent(
|
|
105
110
|
distinct_id,
|
|
@@ -409,7 +414,21 @@ if (require.main === module) {
|
|
|
409
414
|
}
|
|
410
415
|
|
|
411
416
|
else {
|
|
412
|
-
module.exports =
|
|
417
|
+
module.exports = {
|
|
418
|
+
generate: main,
|
|
419
|
+
weightedRange,
|
|
420
|
+
pick,
|
|
421
|
+
day,
|
|
422
|
+
integer,
|
|
423
|
+
makeProducts,
|
|
424
|
+
date,
|
|
425
|
+
progress,
|
|
426
|
+
person,
|
|
427
|
+
choose,
|
|
428
|
+
range,
|
|
429
|
+
exhaust,
|
|
430
|
+
openFinder
|
|
431
|
+
};
|
|
413
432
|
}
|
|
414
433
|
|
|
415
434
|
|
package/package.json
CHANGED
package/utils.js
CHANGED
|
@@ -8,8 +8,13 @@ const utc = require('dayjs/plugin/utc');
|
|
|
8
8
|
dayjs.extend(utc);
|
|
9
9
|
|
|
10
10
|
function pick() {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
try {
|
|
12
|
+
const choice = chance.pickone(this);
|
|
13
|
+
return choice;
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
function date(inTheLast = 30, isPast = true, format = 'YYYY-MM-DD') {
|