Skip to content

Commit 7594012

Browse files
authored
fix: Added check for jschardet constants (#745)
1 parent 1cb4a86 commit 7594012

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/encoding.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { jschardet } from "./vscodeModules";
22

3-
jschardet.Constants.MINIMUM_THRESHOLD = 0.2;
4-
jschardet.MacCyrillicModel.mTypicalPositiveRatio += 0.001;
3+
if (jschardet.Constants) {
4+
jschardet.Constants.MINIMUM_THRESHOLD = 0.2;
5+
jschardet.MacCyrillicModel.mTypicalPositiveRatio += 0.001;
6+
}
57

68
function detectEncodingByBOM(buffer: Buffer): string | null {
79
if (!buffer || buffer.length < 2) {

0 commit comments

Comments
 (0)