From b3e07e236b2ef548f2f3f7b4ad2f40c32afac6c6 Mon Sep 17 00:00:00 2001 From: wukko Date: Tue, 13 Feb 2024 13:50:06 +0600 Subject: [PATCH] loadFromFs: fix shadowing variable name --- api/modules/util/loadFromFs.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/api/modules/util/loadFromFs.js b/api/modules/util/loadFromFs.js index 813522b3..17273737 100644 --- a/api/modules/util/loadFromFs.js +++ b/api/modules/util/loadFromFs.js @@ -7,16 +7,9 @@ const splitDir = path.dirname(fileURLToPath(import.meta.url)).split('/'); splitDir.splice(-2); const dir = splitDir.join('/'); -export function loadJSON(path) { +export function loadJSON(filePath) { try { - return JSON.parse(fs.readFileSync(`${dir}/${path}`, 'utf-8')) - } catch(e) { - return false - } -} -export function loadFile(path) { - try { - return fs.readFileSync(path, 'utf-8') + return JSON.parse(fs.readFileSync(`${dir}/${filePath}`, 'utf-8')) } catch(e) { return false }