This commit is contained in:
Your Name
2024-02-16 20:04:02 -06:00
parent 3bc5e8b792
commit 38b37d25b2

View File

@@ -90,7 +90,7 @@ function calculateDiff(provVarsVariable, oldValue, newValue) {
allKeys.forEach(key => { allKeys.forEach(key => {
const oldKeyValue = oldVal[key]; const oldKeyValue = oldVal[key];
const newKeyValue = newVal[key]; const newKeyValue = newVal[key];
const currentPath = path ? `${path}['${key}']` : `['${key}']`; const currentPath = path ? `${path}[${JSON.stringify(key)}]` : `[${JSON.stringify(key)}]`;
if (!oldVal || !(key in oldVal)) { if (!oldVal || !(key in oldVal)) {
// New key added // New key added
@@ -121,9 +121,9 @@ function calculateDiff(provVarsVariable, oldValue, newValue) {
// Adjust initial call to handle non-object types // Adjust initial call to handle non-object types
if ((typeof oldValue === 'object' && oldValue !== null) && (typeof newValue === 'object' && newValue !== null)) { if ((typeof oldValue === 'object' && oldValue !== null) && (typeof newValue === 'object' && newValue !== null)) {
findChanges('progvars['+provVarsVariable+']', oldValue, newValue); findChanges('progvars['+JSON.stringify(provVarsVariable)+']', oldValue, newValue);
} else if (oldValue !== newValue) { } else if (oldValue !== newValue) {
changes.push(`progvars[${provVarsVariable}] = ${JSON.stringify(newValue)};`); changes.push(`progvars[${JSON.stringify(provVarsVariable)}] = ${JSON.stringify(newValue)};`);
} }
return changes.join('\n'); return changes.join('\n');