@resolveio/client-lib-core 1.1.34 → 1.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -404,7 +404,7 @@ function getDeepDiffDetails(obj1, obj2) {
|
|
|
404
404
|
Object.keys(obj1).forEach(key => {
|
|
405
405
|
if (Array.isArray(obj1[key]) && Array.isArray(obj2[key])) {
|
|
406
406
|
const arrayDiff = obj1[key].map((item, index) => {
|
|
407
|
-
if (typeof item === 'object' && typeof obj2[key][index] === 'object') {
|
|
407
|
+
if (typeof item === 'object' && obj2[key][index] && typeof obj2[key][index] === 'object') {
|
|
408
408
|
return `{${formatObjectDiff(item, obj2[key][index])}}`;
|
|
409
409
|
}
|
|
410
410
|
return `"${item}" to "${obj2[key][index]}"`;
|
|
@@ -420,23 +420,10 @@ function getDeepDiffDetails(obj1, obj2) {
|
|
|
420
420
|
});
|
|
421
421
|
return str.slice(0, -2);
|
|
422
422
|
};
|
|
423
|
-
const formatDiff = (changeType, items) => {
|
|
424
|
-
let str = `${changeType}:\n`;
|
|
425
|
-
Object.keys(items).forEach(key => {
|
|
426
|
-
str += `${toTitleCase(key.replace(/_/g, ' '))}: "${items[key]}",\n`;
|
|
427
|
-
});
|
|
428
|
-
return str.slice(0, -2) + '\n';
|
|
429
|
-
};
|
|
430
|
-
if (Object.keys(diff.added).length > 0) {
|
|
431
|
-
diffString += formatDiff('Added', diff.added);
|
|
432
|
-
}
|
|
433
|
-
if (Object.keys(diff.deleted).length > 0) {
|
|
434
|
-
diffString += formatDiff('Deleted', diff.deleted);
|
|
435
|
-
}
|
|
436
423
|
if (Object.keys(diff.updated).length > 0) {
|
|
437
424
|
diffString += 'Updated:\n';
|
|
438
425
|
Object.keys(diff.updated).forEach(key => {
|
|
439
|
-
if (key.substr(0, 2) !== 'id') {
|
|
426
|
+
if (key.substr(0, 2) !== 'id' && diff.updated[key] !== obj2[key]) { // Avoid repeating the same values
|
|
440
427
|
if (moment.isDate(diff.updated[key])) {
|
|
441
428
|
diffString += `${toTitleCase(key.replace(/_/g, ' '))}: "${moment(diff.updated[key]).format('llll')}" to "${moment(obj2[key]).format('llll')}",\n`;
|
|
442
429
|
}
|
|
@@ -448,7 +435,7 @@ function getDeepDiffDetails(obj1, obj2) {
|
|
|
448
435
|
}
|
|
449
436
|
}
|
|
450
437
|
});
|
|
451
|
-
diffString = diffString.slice(0, -2) + '\n';
|
|
438
|
+
diffString = diffString.slice(0, -2) + '\n'; // Remove the last comma and newline
|
|
452
439
|
}
|
|
453
440
|
return diffString;
|
|
454
441
|
}
|