Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: MMRLApp/ModFS
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.1
Choose a base ref
...
head repository: MMRLApp/ModFS
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 5 commits
  • 5 files changed
  • 1 contributor

Commits on Aug 16, 2024

  1. 1.2.1

    DerGoogler committed Aug 16, 2024
    Copy the full SHA
    6e31d25 View commit details
  2. 1.2.2

    DerGoogler committed Aug 16, 2024
    Copy the full SHA
    b0cd7fc View commit details
  3. 1.3.2

    DerGoogler committed Aug 16, 2024
    Copy the full SHA
    fcda498 View commit details

Commits on Sep 8, 2024

  1. 1.4.2

    DerGoogler committed Sep 8, 2024
    Copy the full SHA
    cf0ba0a View commit details

Commits on Sep 18, 2024

  1. 1.4.3

    DerGoogler committed Sep 18, 2024
    Copy the full SHA
    81e7bfb View commit details
Showing with 332 additions and 39 deletions.
  1. +49 −4 README.md
  2. +2 −1 package.json
  3. +237 −29 src/index.ts
  4. +43 −3 test.mjs
  5. +1 −2 tsconfig.json
53 changes: 49 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,74 @@
# ModFS

**Supports**

`array`, `array.length`, `string`, `number`, `boolean`, custom arrays separator with `<array(, )>`, custom array element start and end with `<array(, |"")>`

Functions now supported `<KEY=(arg1|arg2)>`

Usage

```ts
import ModFS from "modfs";

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("Nice one, <NAME>", {
NAME: "Marvin",
// NAME: undefined -- handle null/undefined values etc
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=(magifsk|mkshrc)>", {
valdilate: (root, mod) => {
if (root.toLowerCase() === "magisk") {
return mod;
} else {
return ""
}
},
});

console.log(result);
```
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "modfs",
"version": "1.1.1",
"version": "1.4.3",
"description": "ModFS is a json format processor and also used in MMRL as the ModFS system",
"main": "dist/index.js",
"type": "module",
"typings": "dist/index.d.ts",
"scripts": {
"prepublish": "npm run build",
Loading