UNPKG

408 BJavaScriptView Raw
1const debugNamesOngoing = new Set();
2export function debugTimerStart(name) {
3 const debugEnvVar = globalThis.process?.env?.['DEBUG'] || globalThis.DEBUG;
4 if (debugEnvVar === '1' || debugEnvVar?.includes(name)) {
5 debugNamesOngoing.add(name);
6 console.time(name);
7 }
8}
9export function debugTimerEnd(name) {
10 if (debugNamesOngoing.has(name)) {
11 console.timeEnd(name);
12 }
13}