-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.mjs
63 lines (48 loc) · 1.59 KB
/
test.mjs
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
52
53
54
55
56
57
58
59
60
61
62
63
import ModFS from "./dist/index.js";
const fs = new ModFS({
ADB: "/data/adb",
MODULES: "<ADB>/modules",
NESTED: {
NAME: "Kevin",
PATH: "<ADB>/user/<NESTED.NAME>",
},
CALL: () => {
return "Nice";
},
});
const text = ModFS.format(
"The family of <human.firstName> goes averagely over <avgAge> years and the fun fact is that the last name of the family is <human.lastName>. Currently the family has a member count of <familyMembers.length>. The names of family are <familyMembers(, )>.",
{
human: {
firstName: "Kevin",
lastName: undefined,
},
avgAge: 100,
familyMembers: ["Granpa", "Papa", "Mama"],
}
);
const zips = ["https://google.com", "https://google.com"];
const urls = ModFS.format('mmrl install local <ZIPFILES( |"")>', {
ZIPFILES: zips,
});
console.log("arrays:", urls);
console.log("ModFS.format:", text);
console.log("get:", fs.get("MODULES"));
console.log("get (nested):", fs.get("NESTED"));
console.log("get (nested.PATH):", fs.get("NESTED.PATH")); // returns "/data/adb/user/Kevin"
console.log("get (nested.NAME):", fs.get("NESTED.NAME")); // returns "Kevin"
console.log("get (function):", fs.get("CALL"));
console.log("formatEntries:", fs.formatEntries());
console.log("entries:", fs.entries);
console.log("stringify:", fs.stringify(null, 4));
console.log("stringifyEntries:", fs.stringifyEntries(null, 4));
const result = ModFS.format("Module <valdilate=(magisk|mkshrc)>", {
valdilate: (root, mod) => {
if (root.toLowerCase() === "magisk") {
return { module: mod };
} else {
return "";
}
},
});
console.log(result);