Skip to content

Commit 20272ce

Browse files
committed
chore: add TODOs for future improvements in ConsoleCatcher
1 parent 5e1eef0 commit 20272ce

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/addons/consoleCatcher.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,13 @@ export class ConsoleCatcher {
232232
return [...this.consoleOutput];
233233
}
234234
}
235+
// TODO:: 1) replace window with globalThis for better compatibility with different environments
236+
// const G = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== 'undefined' ? window : undefined);
237+
// if (!G || !G.console) return;
238+
// G.console[method]...
239+
// TODO:: 2) use .includes() instead of .indexOf() !== -1 for better readability (line 115)
240+
// TODO:: 3) use for...of loop instead of .forEach() for better performance/readability (line 190) for (const method of CONSOLE_METHODS)
241+
// TODO:: 4) extract error stringification logic to separate method to avoid duplication (lines 98, 128)
242+
// TODO:: 5) improve %c style directive parsing logic for better accuracy and edge cases
243+
// TODO:: 6) add type guards for console method access to improve type safety
244+
// TODO:: 7) Store original console methods and implement restore() to revert overrides — allows safe teardown, prevents double-wrapping, and avoids global side-effects.

0 commit comments

Comments
 (0)