Nicer JSON output

This commit is contained in:
schmelczerandras 2020-09-20 23:00:09 +02:00
parent fd64d9491d
commit 938e633e64

View file

@ -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');