aboutsummaryrefslogtreecommitdiffstats
path: root/lib/utils.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-12-01 11:36:35 -0800
committerAdam Soltys <[email protected]>2023-12-01 11:36:35 -0800
commit7709c1efde9a1f3078171ee56985cd25511d6f7b (patch)
treecd996eaaa860cdb3d7da688e0ad4c5ec7bae1a0c /lib/utils.js
parent826c7b361c93905c4725755038d398221530051d (diff)
downloadcoinos-server-7709c1efde9a1f3078171ee56985cd25511d6f7b.tar.gz
coinos-server-7709c1efde9a1f3078171ee56985cd25511d6f7b.zip
biome formatter
Diffstat (limited to 'lib/utils.js')
-rw-r--r--lib/utils.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/utils.js b/lib/utils.js
index 2eac0054..a1612483 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -4,7 +4,7 @@ import config from "$config";
export const nada = () => {};
-export const sleep = n => new Promise(r => setTimeout(r, n));
+export const sleep = (n) => new Promise((r) => setTimeout(r, n));
export const wait = async (f, s = 300, n = 50) => {
let i = 0;
while (!(await f()) && i < s) (await sleep(n)) && i++;
@@ -13,17 +13,17 @@ export const wait = async (f, s = 300, n = 50) => {
};
export const prod = process.env.NODE_ENV === "production";
-export const fail = msg => {
+export const fail = (msg) => {
throw new Error(msg);
};
export const bail = (res, msg) => res.code(500).send(msg);
export const SATS = 100000000;
-export const sats = n => Math.round(n * SATS);
-export const btc = n => parseFloat((n / SATS).toFixed(8));
+export const sats = (n) => Math.round(n * SATS);
+export const btc = (n) => parseFloat((n / SATS).toFixed(8));
-export const uniq = (a, k) => [...new Map(a.map(x => [k(x), x])).values()];
+export const uniq = (a, k) => [...new Map(a.map((x) => [k(x), x])).values()];
export const pick = (O, K) =>
K.reduce((o, k) => (typeof O[k] !== "undefined" && (o[k] = O[k]), o), {});
@@ -56,7 +56,7 @@ export const fields = [
"banner"
];
-export const getUser = async username => {
+export const getUser = async (username) => {
username = username.replace(/\s/g, "").toLowerCase();
let uid = await g(`user:${username}`);
return g(`user:${uid}`);