Nicer JSON output
This commit is contained in:
parent
fd64d9491d
commit
938e633e64
1 changed files with 3 additions and 1 deletions
|
|
@ -1,2 +1,4 @@
|
|||
export const prettyPrint = (o: any): string =>
|
||||
JSON.stringify(o, (_, v) => (v.toFixed ? Number(v.toFixed(2)) : v), ' ');
|
||||
JSON.stringify(o, (_, v) => (v.toFixed ? Number(v.toFixed(3)) : v), ' ')
|
||||
.replace(/("|,|{|^\n)/g, '')
|
||||
.replace(/(\W*}\n?)+/g, '\n\n');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue