Skip to content

Commit 78eda8c

Browse files
committed
improvement for counting lines
1 parent 9d55d57 commit 78eda8c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dictionary/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function displayError(
101101
currentLine = currentPosition = nextLine;
102102
}
103103
}
104-
const line = source.slice(0, startLine).split(/\n(?!$)/).length + 1;
104+
const line = source.slice(0, startLine).match(/\n/g)?.length ?? 1;
105105
const column = position - startLine + 1;
106106
console.error(` at %c${SOURCE}:${line}:${column}`, sourceStyle);
107107
console.error();

0 commit comments

Comments
 (0)