From 938e633e6470e7eff2e21f88c7e622f197a8a3af Mon Sep 17 00:00:00 2001 From: schmelczerandras Date: Sun, 20 Sep 2020 23:00:09 +0200 Subject: [PATCH] Nicer JSON output --- src/helper/pretty-print.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/helper/pretty-print.ts b/src/helper/pretty-print.ts index 4b21da7..704a6fc 100644 --- a/src/helper/pretty-print.ts +++ b/src/helper/pretty-print.ts @@ -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');