benjamine / jsondiffpatch

Diff & patch JavaScript objects
MIT License
4.77k stars 464 forks source link

HTML formatter without changes #370

Closed masciugo closed 3 months ago

masciugo commented 3 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 3 months ago

It works with delta={}