Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

Commit

Permalink
Show undefined for unserializable by javascript-stringify data (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
zalmoxisus authored and alexkuz committed Mar 5, 2017
1 parent 6e17fd9 commit 5202f01
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tabs/JSONDiff.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ type State = {
};

function stringifyAndShrink(val: any, isWideLayout: boolean): string {
const str = stringify(val);
if (val === null) { return 'null'; }
else if (typeof val === 'undefined') { return 'undefined'; }

const str = stringify(val);
if (typeof str === 'undefined') { return 'undefined'; }

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

0 comments on commit 5202f01

Please sign in to comment.