diff options
author | Ivan Chen <ivan@tagg.id> | 2021-06-09 17:41:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-09 17:41:29 -0400 |
commit | d13d12980555cb1f659ae5108c52f089a54c3f57 (patch) | |
tree | 145098b27611a955d40118046e275a6ae940d969 /src/utils/common.ts | |
parent | 587d08dc8f0508b6efa76cc7d57f21ac2a5fd9fb (diff) | |
parent | 93796732be3f5070c0a124d29533396f79736c83 (diff) |
Merge pull request #456 from brian-tagg/tma872-purple-indicator
[TMA-872] purple indicator
Diffstat (limited to 'src/utils/common.ts')
-rw-r--r-- | src/utils/common.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/utils/common.ts b/src/utils/common.ts index cfd9244a..1956e811 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -233,3 +233,8 @@ export const badgesToDisplayBadges = ( img: badgeToImgMap[b.category + b.name], })); }; + +// Documentation: https://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript +export const numberWithCommas = (digits: number) => { + return digits.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); +}; |