-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
51 lines (41 loc) · 1.04 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"use strict";
const fileMap = require("./lib/fileMap");
const forEachMap = require("./lib/forEach");
const createFile = require("./lib/createfile");
const { default_must } = require("./lib/utils");
function create(root, path, options) {
if (typeof path === "string") {
path = treePath(path);
}
return createFile(root, path, options);
}
function treePath(target, options) {
if (typeof target !== "object") {
target = fileMap(target, options);
}
return forEachMap(target);
}
function main(target, default_opentions) {
// 处理默认参数
if (!default_opentions) {
default_opentions = default_must;
}
var File_Node = fileMap(target);
var File_Array_Path = forEachMap(File_Node);
// 接收一个 根目录 一个配置对象
function middleSetFilePath(root, options) {
return createFile(root, File_Array_Path, options)
}
return {
FileNode: File_Node,
FilePathArrs: File_Array_Path,
generFile: middleSetFilePath,
};
}
module.exports = {
main,
create,
treePath,
fileMap,
default_must,
};