export const PERF_DIAG_ENV = 'METOYOU_PERF_DIAG'; export const PERF_DIAG_FORCE_ENV = 'METOYOU_PERF_DIAG_FORCE'; const TRUTHY = new Set([ '1', 'true', 'yes', 'on' ]); function isTruthyFlag(value: string | undefined): boolean { return TRUTHY.has(String(value ?? '').trim() .toLowerCase()); } export function isPerfDiagEnabled( env: NodeJS.ProcessEnv, isPackaged: boolean ): boolean { if (isPackaged) { return true; } return isTruthyFlag(env[PERF_DIAG_ENV]); }