aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-05-17 18:43:22 -0700
committerAdam Soltys <[email protected]>2024-05-17 18:43:22 -0700
commitcc6ef7b76b7a7bb2f7b0c4c1a35dd80d3b3e13a1 (patch)
tree5ef5bccb43c25f8aa45e779f27072c6cf65331d1 /src/lib/utils.js
parentda6ee264d5b9bbdb523c1627751c1d04a4bb8943 (diff)
downloadcoinos-ui-cc6ef7b76b7a7bb2f7b0c4c1a35dd80d3b3e13a1.tar.gz
coinos-ui-cc6ef7b76b7a7bb2f7b0c4c1a35dd80d3b3e13a1.zip
wrap usernames
Diffstat (limited to 'src/lib/utils.js')
-rw-r--r--src/lib/utils.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/lib/utils.js b/src/lib/utils.js
index 6902c928..a897bed8 100644
--- a/src/lib/utils.js
+++ b/src/lib/utils.js
@@ -42,7 +42,7 @@ export let get = (url, headers = {}) => {
};
export let post = async (url, body, headers) => {
- headers = {
+ headers = {
"content-type": "application/json",
accept: "application/json",
...headers,
@@ -185,13 +185,18 @@ export let fd = async (req) => {
return obj;
};
-export let f = (s, currency) =>
- new Intl.NumberFormat("en-US", {
- style: "currency",
- currency,
- })
- .format(s)
- .replace("CA", "");
+export let f = (s, currency) => {
+ try {
+ return new Intl.NumberFormat("en-US", {
+ style: "currency",
+ currency,
+ })
+ .format(s)
+ .replace("CA", "");
+ } catch (e) {
+ return "";
+ }
+};
export let s = (s) =>
new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 }).format(s);