(file)
| 1 | import { readFileSync } from "fs"; |
| 2 | export 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 | } |