MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / loadJson

Function loadJson

scripts/i18n-manager.mjs:92–100  ·  view source on GitHub ↗

Safely reads a JSON file.

(filePath)

Source from the content-addressed store, hash-verified

90
91/** Safely reads a JSON file. */
92function loadJson(filePath) {
93 if (!fs.existsSync(filePath)) return {};
94 try {
95 return JSON.parse(fs.readFileSync(filePath, 'utf8'));
96 } catch (error) {
97 console.error(`Error parsing JSON file ${filePath}:`, error.message);
98 return {};
99 }
100}
101
102/** Writes a JSON file with standardized formatting. */
103function saveJson(filePath, data) {

Callers 6

syncFunction · 0.85
verifyFunction · 0.85
generateTemplateFunction · 0.85
statusFunction · 0.85
findUnusedFunction · 0.85
checkUsageFunction · 0.85

Calls 2

parseMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected