Skip to content

Commit 54061e9

Browse files
committed
perf(linter/plugins): avoid implicit boolean coercion in initLines (#15641)
Tiny perf optimization. Explicitly check `!== null` instead of incurring cost of implicit boolean coercion.
1 parent 24d00f4 commit 54061e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/oxlint/src-js/plugins/location.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function initLines(): void {
7878
let lastOffset = 0,
7979
offset,
8080
match;
81-
while ((match = LINE_BREAK_PATTERN.exec(sourceText))) {
81+
while ((match = LINE_BREAK_PATTERN.exec(sourceText)) !== null) {
8282
offset = match.index;
8383
lines.push(sourceText.slice(lastOffset, offset));
8484
lineStartOffsets.push((lastOffset = offset + match[0].length));

0 commit comments

Comments
 (0)