1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.default = default_1;
|
11 | const host_tree_1 = require("../tree/host-tree");
|
12 | function generateStringOfLength(l) {
|
13 | return new Array(l)
|
14 | .fill(0)
|
15 | .map((_x) => {
|
16 | return 'abcdefghijklmnopqrstuvwxyz'[Math.floor(Math.random() * 26)];
|
17 | })
|
18 | .join('');
|
19 | }
|
20 | function random(from, to) {
|
21 | return Math.floor(Math.random() * (to - from)) + from;
|
22 | }
|
23 | function default_1(options) {
|
24 | return () => {
|
25 | const root = 'root' in options ? options.root : '/';
|
26 | const map = new host_tree_1.HostTree();
|
27 | const nbFiles = 'multiFiles' in options
|
28 | ? typeof options.multiFiles == 'number'
|
29 | ? options.multiFiles
|
30 | : random(2, 12)
|
31 | : 1;
|
32 | for (let i = 0; i < nbFiles; i++) {
|
33 | const path = 'a/b/c/d/e/f'.slice(Math.random() * 10);
|
34 | const fileName = generateStringOfLength(20);
|
35 | const content = generateStringOfLength(100);
|
36 | map.create(root + '/' + path + '/' + fileName, content);
|
37 | }
|
38 | return map;
|
39 | };
|
40 | }
|