From 06f258a00b2501b26e8f3feff4d1bccc0cf5ff91 Mon Sep 17 00:00:00 2001 From: Leon Xu Date: Tue, 3 May 2022 21:00:51 -0700 Subject: [PATCH] doc: add prettyPrintStat method --- src/util.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util.js b/src/util.js index d1ae238..1ab3b32 100644 --- a/src/util.js +++ b/src/util.js @@ -22,6 +22,9 @@ export const sortData = (data) => { return sortedData.sort((a, b) => (a.cases > b.cases ? -1 : 1)); }; +export const prettyPrintStat = (stat) => + stat ? `+${numeral(stat).format("0.0a")}` : "+0"; + export const showDataOnMap = (data, casesType = "cases") => data.map((country) => (