aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/utils.js')
-rw-r--r--src/lib/utils.js10
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);