diff options
| author | Adam Soltys <[email protected]> | 2022-09-13 23:18:40 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-09-13 23:18:40 -0700 |
| commit | 14a9420cc0e8f96e77beeacd02f7dcb44ff76134 (patch) | |
| tree | f17d64d80e62470db4c563d830519fcbbd182482 /src/lib/utils.js | |
| parent | 328b987ca0b5bc3fadd4c43266775aece93e1df2 (diff) | |
| download | coinos-ui-14a9420cc0e8f96e77beeacd02f7dcb44ff76134.tar.gz coinos-ui-14a9420cc0e8f96e77beeacd02f7dcb44ff76134.zip | |
currency formatting helpers
Diffstat (limited to 'src/lib/utils.js')
| -rw-r--r-- | src/lib/utils.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/utils.js b/src/lib/utils.js index 0f665ec4..80419a45 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -127,3 +127,13 @@ export const auth = (req) => { let { token } = cookie.parse(req.headers.get('cookie') || ''); return { authorization: `Bearer ${token}` }; }; + +export const f = (s, currency) => + new Intl.NumberFormat('en-US', { + style: 'currency', + currency + }) + .format(s) + .replace('CA', ''); + +export const s = (s) => new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(s); |
