aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-28 08:20:19 -0800
committerAdam Soltys <[email protected]>2024-11-28 08:20:19 -0800
commit0f5b1249fe7e45ca8a838d9c9cf6b2db6440973e (patch)
treefa5b1c20c7d7007956bdd82b5d1f225dd9b61450 /src/lib
parentcf549f032e78591d4a899e73f92e026073993968 (diff)
downloadcoinos-ui-0f5b1249fe7e45ca8a838d9c9cf6b2db6440973e.tar.gz
coinos-ui-0f5b1249fe7e45ca8a838d9c9cf6b2db6440973e.zip
handle undefined
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/utils.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index 641cec31..60e30fe5 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -274,7 +274,11 @@ const map = {
IRR: "fa-IR",
};
-export const loc = ({ currency: c, language: l }) => map[l]?.[c] || map[c];
+export const loc = (user) => {
+ if (!user) return;
+ const { currency: c, language: l } = user;
+ return map[l]?.[c] || map[c];
+};
export const f = (s: number, currency: string, locale = "en-US") =>
new Intl.NumberFormat(locale, {