🚨 Allow output to console for now
This commit is contained in:
parent
5fd25d1095
commit
145e2ca2cb
2 changed files with 4 additions and 3 deletions
|
@ -19,7 +19,7 @@ function bpParse(dv: DataView, posIn: number = 0): { obj: any, pos: number } {
|
|||
const out1 = bpParse(dv, pos);
|
||||
pos = out1.pos;
|
||||
if (typeof out1.obj !== 'string') {
|
||||
throw new Error(`Expected dictionary key to be string but it is "${typeof out1.obj}"`);
|
||||
throw new Error(`Expected dictionary key to be string but it is "${typeof out1.obj}".`);
|
||||
}
|
||||
//read value
|
||||
const out2 = bpParse(dv, pos);
|
||||
|
@ -45,7 +45,7 @@ function bpParse(dv: DataView, posIn: number = 0): { obj: any, pos: number } {
|
|||
let curNumber = 0;
|
||||
while (curChar !== 0x65) { //'e' - end
|
||||
if (curChar < 0x30 || curChar > 0x39) {
|
||||
throw new Error('Unexpected int char during bencode parsing');
|
||||
throw new Error('Unexpected int char during bencode parsing.');
|
||||
}
|
||||
curNumber *= 10;
|
||||
curNumber += curChar - 0x30;
|
||||
|
@ -61,7 +61,7 @@ function bpParse(dv: DataView, posIn: number = 0): { obj: any, pos: number } {
|
|||
let strLen = 0;
|
||||
while (curChar !== 0x3A) { //':' - integer delimiter, beginning of string
|
||||
if (curChar < 0x30 || curChar > 0x39) {
|
||||
throw new Error('Unexpected string length during bencode parsing');
|
||||
throw new Error('Unexpected string length during bencode parsing.');
|
||||
}
|
||||
strLen *= 10;
|
||||
strLen += curChar - 0x30;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
"indent": [true, "spaces", 2],
|
||||
"max-line-length": false,
|
||||
"no-bitwise": false,
|
||||
"no-console": false,
|
||||
"quotemark": [true, "single"]
|
||||
},
|
||||
"rulesDirectory": []
|
||||
|
|
Loading…
Reference in a new issue