MCPcopy Create free account
hub / github.com/Explosion-Scratch/firebuilder / readJSON

Function readJSON

helpers/readJson.js:2–13  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

1import { readFileSync } from "fs";
2export default function readJSON(file) {
3 try {
4 const fileContent = readFileSync(file, "utf-8")
5 .split("\n")
6 .filter((i) => !i.trim().startsWith("//"))
7 .join("\n");
8 return JSON.parse(fileContent);
9 } catch (e) {
10 console.log("Error reading " + file);
11 return {};
12 }
13}

Callers 5

runFunction · 0.85
cli.jsFile · 0.85
handleFunction · 0.85
handleFunction · 0.85
handleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected