Skip to content

Commit e25324c

Browse files
logaretmclaude
andcommitted
refactor(core): Use if-guard instead of ??= for regex lazy init
Matches the style used elsewhere in the repo. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9f8d834 commit e25324c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

packages/core/src/integrations/postgresjs.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,9 @@ export function _sanitizeSqlQuery(sqlQuery: string | undefined): string {
361361
// Lazy init: constructing this at module scope would evaluate the lookbehind
362362
// on import and crash Safari <16.4 browser bundles that reach this file via
363363
// the core barrel. Building it on first call keeps the cost off the import path.
364-
integerLiteralRE ??= new RegExp('(?<!\\$)-?\\b\\d+\\b', 'g');
364+
if (!integerLiteralRE) {
365+
integerLiteralRE = new RegExp('(?<!\\$)-?\\b\\d+\\b', 'g');
366+
}
365367

366368
return (
367369
sqlQuery

0 commit comments

Comments
 (0)