@resolveio/client-lib-core 1.1.35 → 1.1.36
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.
- package/esm2020/lib/util/common.helper.mjs +21 -31
- package/fesm2015/resolveio-client-lib-core.mjs +20 -30
- package/fesm2015/resolveio-client-lib-core.mjs.map +1 -1
- package/fesm2020/resolveio-client-lib-core.mjs +20 -30
- package/fesm2020/resolveio-client-lib-core.mjs.map +1 -1
- package/lib/util/common.helper.d.ts +1 -1
- package/package.json +1 -1
|
@@ -400,42 +400,32 @@ function getDeepDiffDetails(obj1, obj2) {
|
|
|
400
400
|
let diff = detailedDiff(obj1, obj2);
|
|
401
401
|
let diffString = '';
|
|
402
402
|
const formatObjectDiff = (obj1, obj2) => {
|
|
403
|
-
|
|
404
|
-
|
|
403
|
+
if (!obj1 || !obj2)
|
|
404
|
+
return '';
|
|
405
|
+
return Object.keys(obj1)
|
|
406
|
+
.map(key => {
|
|
405
407
|
if (Array.isArray(obj1[key]) && Array.isArray(obj2[key])) {
|
|
406
|
-
const arrayDiff = obj1[key].map((item, index) =>
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
return `"${item}" to "${obj2[key][index]}"`;
|
|
411
|
-
}).join(', ');
|
|
412
|
-
str += `${toTitleCase(key.replace(/_/g, ' '))}: [${arrayDiff}], `;
|
|
413
|
-
}
|
|
414
|
-
else if (typeof obj1[key] === 'object' && obj1[key] !== null && obj2[key] !== null) {
|
|
415
|
-
str += `${toTitleCase(key.replace(/_/g, ' '))}: {${formatObjectDiff(obj1[key], obj2[key])}}, `;
|
|
408
|
+
const arrayDiff = obj1[key].map((item, index) => typeof item === 'object' && obj2[key][index]
|
|
409
|
+
? `{${formatObjectDiff(item, obj2[key][index])}}`
|
|
410
|
+
: `"${item}" to "${obj2[key][index]}"`).join(', ');
|
|
411
|
+
return `${toTitleCase(key)}: [${arrayDiff}]`;
|
|
416
412
|
}
|
|
417
|
-
|
|
418
|
-
|
|
413
|
+
if (typeof obj1[key] === 'object' && obj2[key]) {
|
|
414
|
+
return `${toTitleCase(key)}: {${formatObjectDiff(obj1[key], obj2[key])}}`;
|
|
419
415
|
}
|
|
420
|
-
|
|
421
|
-
|
|
416
|
+
return `${toTitleCase(key)}: "${obj1[key]}" to "${obj2[key]}"`;
|
|
417
|
+
})
|
|
418
|
+
.join(', ');
|
|
422
419
|
};
|
|
423
420
|
if (Object.keys(diff.updated).length > 0) {
|
|
424
421
|
diffString += 'Updated:\n';
|
|
425
|
-
Object.keys(diff.updated)
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
}
|
|
433
|
-
else {
|
|
434
|
-
diffString += `${toTitleCase(key.replace(/_/g, ' '))}: "${diff.updated[key]}" to "${obj2[key]}",\n`;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
diffString = diffString.slice(0, -2) + '\n'; // Remove the last comma and newline
|
|
422
|
+
const updates = Object.keys(diff.updated)
|
|
423
|
+
.filter(key => key.substr(0, 2) !== 'id' && diff.updated[key] !== obj2[key])
|
|
424
|
+
.map(key => moment.isDate(diff.updated[key])
|
|
425
|
+
? `${toTitleCase(key)}: "${moment(diff.updated[key]).format('llll')}" to "${moment(obj2[key]).format('llll')}"`
|
|
426
|
+
: `${toTitleCase(key)}: {${formatObjectDiff(diff.updated[key], obj2[key])}}`)
|
|
427
|
+
.join(',\n');
|
|
428
|
+
diffString += updates ? `${updates}\n` : '';
|
|
439
429
|
}
|
|
440
430
|
return diffString;
|
|
441
431
|
}
|