Skip to content

Commit

Permalink
chore(dashboard): add debug printer
Browse files Browse the repository at this point in the history
  • Loading branch information
GerilLeto committed Aug 15, 2023
1 parent bfe366b commit 0ab897a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions dashboard/src/utils/diff-json.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import _ from 'lodash';
import { AnyObject } from '..';

function printChanges(a: any, b: any) {
if (_.isEqual(a, b)) {
return;
}
if (Array.isArray(a) && Array.isArray(b)) {
a.forEach((_a, i) => {
printChanges(_a, b[i]);
});
return;
}
console.log(a, b);
}

export function printJSONChanges(a: AnyObject, b: AnyObject) {
Object.keys(a).forEach((k) => {
printChanges(a[k], b[k]);
});
}

0 comments on commit 0ab897a

Please sign in to comment.