Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 5202f01

Browse files
zalmoxisusalexkuz
authored andcommitted
Show undefined for unserializable by javascript-stringify data (alexkuz#65)
1 parent 6e17fd9 commit 5202f01

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/tabs/JSONDiff.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ type State = {
2323
};
2424

2525
function stringifyAndShrink(val: any, isWideLayout: boolean): string {
26-
const str = stringify(val);
2726
if (val === null) { return 'null'; }
28-
else if (typeof val === 'undefined') { return 'undefined'; }
27+
28+
const str = stringify(val);
29+
if (typeof str === 'undefined') { return 'undefined'; }
2930

3031
if (isWideLayout) return str.length > 42 ? str.substr(0, 30) + '…' + str.substr(-10) : str;
3132
return str.length > 22 ? `${str.substr(0, 15)}${str.substr(-5)}` : str;

0 commit comments

Comments
 (0)