UNPKG

standardlint

Version:
24 lines (21 loc) 498 B
import { readFile } from "./chunk-73VTGGA6.mjs"; import { exists } from "./chunk-DRBJPZVI.mjs"; // src/utils/getJSONFileContents.ts import path from "node:path"; function getJSONFileContents(basePath, filePath) { try { const fullPath = path.join(basePath, filePath); if (exists(fullPath)) return JSON.parse(readFile(fullPath)); return {}; } catch (error) { console.error("Unable to read contents of file...", error); return {}; } } export { getJSONFileContents };