From 43e91efe99456637eecaa804485aabcec28ab414 Mon Sep 17 00:00:00 2001 From: Kevin Nennig Date: Mon, 2 Oct 2023 14:45:04 -0400 Subject: [PATCH] lint fix --- importObjectUtil.js | 4 ++-- parserUtil.js | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/importObjectUtil.js b/importObjectUtil.js index f2ec4bc..9d4f123 100644 --- a/importObjectUtil.js +++ b/importObjectUtil.js @@ -56,7 +56,7 @@ async function updateSettings(importObj, newSettingsFile) { // Replaces a settings key/value pair in the objName if present in the importData function replaceSettings(importData, tagComponentName, objName, newSettings) { - let componentArr = importData[tagComponentName] + let componentArr = importData[tagComponentName]; if (componentArr) { for (const key of componentArr) { const keyName = key.attributes.name; @@ -68,7 +68,7 @@ function replaceSettings(importData, tagComponentName, objName, newSettings) { for (const setting in newSettings) { settings = parserUtil.replaceValueInJSON(settings, setting, newSettings[setting]); } - debugNewSettings("Applying to settings JSON:") + debugNewSettings("Applying to settings JSON:"); debugNewSettings(settings); key.attributes.settings = JSON.stringify(settings); return importData; diff --git a/parserUtil.js b/parserUtil.js index a737df9..6de3b62 100644 --- a/parserUtil.js +++ b/parserUtil.js @@ -49,12 +49,12 @@ function replaceValueInJSON(jsonObject, keyToFind, newValue) { } else { for (const key in jsonObject) { debugReplace("replace: " + key); - if (key === keyToFind) { - debugReplace("Found key '" + keyToFind + "' with value '" + jsonObject[key] + "' and replacing with '" + newValue + "'"); - jsonObject[key] = newValue; - } else { - jsonObject[key] = replaceValueInJSON(jsonObject[key], keyToFind, newValue); - } + if (key === keyToFind) { + debugReplace("Found key '" + keyToFind + "' with value '" + jsonObject[key] + "' and replacing with '" + newValue + "'"); + jsonObject[key] = newValue; + } else { + jsonObject[key] = replaceValueInJSON(jsonObject[key], keyToFind, newValue); + } } } return jsonObject;