Skip to content

Commit c9b25f6

Browse files
author
patched.codes[bot]
committed
Patched /tmp/tmpxxdlz_5a/src/modules/onify/v1/mergeDataFunctions.js
1 parent a3cdae2 commit c9b25f6

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/modules/onify/v1/mergeDataFunctions.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,9 @@ function generateHTMLReport(report, detailedDiffs, originalTargetData, sourceDat
254254
htmlReport += `<li>${change.path.join('.')} extended with ${JSON.stringify(change.item.rhs)}</li>`;
255255
const arrayValueToHighlight = JSON.stringify(change.item.rhs).replace(/ /g, '&nbsp;');
256256
const escapedArrayValueToHighlight = escapeRegExp(arrayValueToHighlight);
257-
afterStr = afterStr.replace(new RegExp(escapedArrayValueToHighlight, "g"), `<strong>${arrayValueToHighlight}</strong>`);
258-
} else if (change.kind === 'E' || change.kind === 'N') {
257+
const RE2 = require('re2');
258+
259+
afterStr = afterStr.replace(new RE2(escapedArrayValueToHighlight), `<strong>${arrayValueToHighlight}</strong>`); } else if (change.kind === 'E' || change.kind === 'N') {
259260
try {
260261
const lhsObj = JSON.parse(change.lhs);
261262
const rhsObj = JSON.parse(change.rhs);
@@ -269,22 +270,25 @@ function generateHTMLReport(report, detailedDiffs, originalTargetData, sourceDat
269270

270271
const diffValue = diff.rhs.replace(/ /g, '&nbsp;');
271272
const escapedDiffValue = escapeRegExp(diffValue);
272-
afterStr = afterStr.replace(new RegExp(escapedDiffValue, "g"), `<strong>${diffValue}</strong>`);
273-
});
273+
const RE2 = require('re2');
274+
275+
afterStr = afterStr.replace(new RE2(escapedDiffValue), `<strong>${diffValue}</strong>`); });
274276
} else {
275277
// Handle primitive types or non-JSON strings
276278
htmlReport += `<li>${change.path.join('.')} changed from ${JSON.stringify(change.lhs)} to ${JSON.stringify(change.rhs)}</li>`;
277279
let valueToHighlight = JSON.stringify(change.rhs).replace(/ /g, '&nbsp;');
278280
const escapedValueToHighlight = escapeRegExp(valueToHighlight);
279-
afterStr = afterStr.replace(new RegExp(escapedValueToHighlight, "g"), `<strong>${valueToHighlight}</strong>`);
280-
}
281+
const RE2 = require('re2');
282+
283+
afterStr = afterStr.replace(new RE2(String(escapedValueToHighlight)), `<strong>${valueToHighlight}</strong>`); }
281284
} catch (e) {
282285
// Handle primitive types or non-JSON strings
283286
htmlReport += `<li>${change.path.join('.')} changed from ${JSON.stringify(change.lhs)} to ${JSON.stringify(change.rhs)}</li>`;
284287
let valueToHighlight = JSON.stringify(change.rhs).replace(/ /g, '&nbsp;');
285288
const escapedValueToHighlight = escapeRegExp(valueToHighlight);
286-
afterStr = afterStr.replace(new RegExp(escapedValueToHighlight, "g"), `<strong>${valueToHighlight}</strong>`);
287-
}
289+
const RE2 = require('re2');
290+
291+
afterStr = afterStr.replace(new RE2(escapedValueToHighlight), `<strong>${valueToHighlight}</strong>`); }
288292
}
289293
}
290294
});

0 commit comments

Comments
 (0)