@playform/build - v0.3.0
    Preparing search index...

    Module Interface/JSON

    The name or path of the JSON file to parse.

    An optional string representing the directory path from which the JSON file should be loaded. If provided, it will be used as the base directory path. If not provided, the current directory will be used as the base directory path.

    Promise The parsed JSON content.

    Reading a configuration file:

    import JSONInterface from "./Interface/JSON.js";

    const readConfig: JSONInterface = async (File, From) => {
    const content = await JSON.parse(await readFile(`${From ?? "."}/${File}`, "utf-8"));
    return content;
    };

    Reading from current directory:

    const config = await readConfig("package.json");
    

    Reading from specific directory:

    const config = await readConfig("tsconfig.json", "./Source");
    

    Interfaces

    Interface

    The function 'JSON' is a TypeScript function that reads a JSON file and returns its parsed content.