From 3161dd7ee95b6c7d70f8341298dd4fab84cda8b0 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 2 Sep 2022 14:47:08 -0700 Subject: es6 migration --- lib/utils.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/utils.js') diff --git a/lib/utils.js b/lib/utils.js index 1de8ffeb..af50d7ec 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,7 +1,7 @@ -import sequelize from 'sequelize'; +import sequelize from '@sequelize/core'; const { Op } = sequelize; -getUser = async (username, transaction) => { +export const getUser = async (username, transaction) => { let params = { include: [ { @@ -25,7 +25,7 @@ getUser = async (username, transaction) => { return user; }; -getUserById = async (id, transaction) => { +export const getUserById = async (id, transaction) => { let params = { include: [ { @@ -46,3 +46,11 @@ getUserById = async (id, transaction) => { return user; }; + +export const prod = process.env.NODE_ENV === "production"; +export const fail = msg => { + throw new Error(msg); +}; + +export const SATS = 100000000; +export const toSats = n => Math.round(n * SATS); -- cgit v1.2.3