Skip to content

Commit

Permalink
Patched /tmp/tmpxxdlz_5a/src/modules/onify/v1/mergeDataFunctions.js
Browse files Browse the repository at this point in the history
  • Loading branch information
patched.codes[bot] committed Sep 2, 2024
1 parent a3cdae2 commit c9b25f6
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/modules/onify/v1/mergeDataFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,9 @@ function generateHTMLReport(report, detailedDiffs, originalTargetData, sourceDat
htmlReport += `<li>${change.path.join('.')} extended with ${JSON.stringify(change.item.rhs)}</li>`;
const arrayValueToHighlight = JSON.stringify(change.item.rhs).replace(/ /g, '&nbsp;');
const escapedArrayValueToHighlight = escapeRegExp(arrayValueToHighlight);
afterStr = afterStr.replace(new RegExp(escapedArrayValueToHighlight, "g"), `<strong>${arrayValueToHighlight}</strong>`);
} else if (change.kind === 'E' || change.kind === 'N') {
const RE2 = require('re2');

afterStr = afterStr.replace(new RE2(escapedArrayValueToHighlight), `<strong>${arrayValueToHighlight}</strong>`); } else if (change.kind === 'E' || change.kind === 'N') {
try {
const lhsObj = JSON.parse(change.lhs);
const rhsObj = JSON.parse(change.rhs);
Expand All @@ -269,22 +270,25 @@ function generateHTMLReport(report, detailedDiffs, originalTargetData, sourceDat

const diffValue = diff.rhs.replace(/ /g, '&nbsp;');
const escapedDiffValue = escapeRegExp(diffValue);
afterStr = afterStr.replace(new RegExp(escapedDiffValue, "g"), `<strong>${diffValue}</strong>`);
});
const RE2 = require('re2');

afterStr = afterStr.replace(new RE2(escapedDiffValue), `<strong>${diffValue}</strong>`); });
} else {
// Handle primitive types or non-JSON strings
htmlReport += `<li>${change.path.join('.')} changed from ${JSON.stringify(change.lhs)} to ${JSON.stringify(change.rhs)}</li>`;
let valueToHighlight = JSON.stringify(change.rhs).replace(/ /g, '&nbsp;');
const escapedValueToHighlight = escapeRegExp(valueToHighlight);
afterStr = afterStr.replace(new RegExp(escapedValueToHighlight, "g"), `<strong>${valueToHighlight}</strong>`);
}
const RE2 = require('re2');

afterStr = afterStr.replace(new RE2(String(escapedValueToHighlight)), `<strong>${valueToHighlight}</strong>`); }
} catch (e) {
// Handle primitive types or non-JSON strings
htmlReport += `<li>${change.path.join('.')} changed from ${JSON.stringify(change.lhs)} to ${JSON.stringify(change.rhs)}</li>`;
let valueToHighlight = JSON.stringify(change.rhs).replace(/ /g, '&nbsp;');
const escapedValueToHighlight = escapeRegExp(valueToHighlight);
afterStr = afterStr.replace(new RegExp(escapedValueToHighlight, "g"), `<strong>${valueToHighlight}</strong>`);
}
const RE2 = require('re2');

afterStr = afterStr.replace(new RE2(escapedValueToHighlight), `<strong>${valueToHighlight}</strong>`); }
}
}
});
Expand Down

0 comments on commit c9b25f6

Please sign in to comment.