Skip to content

Commit 0252b28

Browse files
committed
fix: fixes #367
1 parent 48b8d58 commit 0252b28

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • packages/jsondiffpatch/src/formatters

packages/jsondiffpatch/src/formatters/html.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ class HtmlFormatter extends BaseFormatter<HtmlFormatterContext> {
3030
}
3131

3232
formatValue(context: HtmlFormatterContext, value: unknown) {
33-
context.out(`<pre>${htmlEscape(JSON.stringify(value, null, 2))}</pre>`);
33+
const valueAsHtml = typeof value === "undefined"
34+
? "undefined"
35+
: htmlEscape(JSON.stringify(value, null, 2));
36+
context.out(`<pre>${valueAsHtml}</pre>`);
3437
}
3538

3639
formatTextDiffString(context: HtmlFormatterContext, value: string) {

0 commit comments

Comments
 (0)