summaryrefslogtreecommitdiff
path: root/u/leftpadesque/debug.ts
blob: 074e56798f635a611fb5ee0f83cabee9b4ad93b8 (plain)
1
2
3
4
5
6
7
8
const _hasEnv = true; // Node.js always has access to environment variables

const _env: 'development' | 'production' =
    _hasEnv && (process.env.ENVIRONMENT ?? '').toLowerCase().includes('prod') ? 'production' : 'development';
export const isProd = () => _env === 'production';

const _debug = !isProd() || (_hasEnv && ['y', 't'].some((process.env.DEBUG ?? '').toLowerCase().startsWith));
export const isDebug = () => _debug;