Skip to content

ModFS is a json format processor and also used in MMRL as the ModFS system. See it in action at mmrl.dergoogler.com

License

Notifications You must be signed in to change notification settings

DerGoogler/modfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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(
  "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);

About

ModFS is a json format processor and also used in MMRL as the ModFS system. See it in action at mmrl.dergoogler.com

Topics

Resources

License

Stars

Watchers

Forks