benjamine / jsondiffpatch

Diff & patch JavaScript objects
MIT License
4.86k stars 472 forks source link

HTML formatter without changes #370

Closed masciugo closed 6 months ago

masciugo commented 6 months ago

Is there a way to show unchanged when the delta is undefined, that is there are no changes? The following produce an empty string when there are no changes

var delta = jsondiffpatch.diff(left, right);
// left is optional, if specified unchanged values will be visible too
document.getElementBy('the-diff').innerHTML =
  jsondiffpatch.formatters.html.format(delta, left);

// Also you can dinamically show/hide unchanged values
jsondiffpatch.formatters.html.showUnchanged();

Basically I need to show the left json as it is

masciugo commented 6 months ago

It works with delta={}