Skip to content

Commit

Permalink
style(json-pack): 💄 run Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Dec 10, 2023
1 parent ceff648 commit 94f7441
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/json-pack/resp/RespDecoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,16 @@ export class RespDecoder<R extends IReader & IReaderResettable = IReader & IRead
const reader = this.reader;
const type = reader.u8();
switch (type) {
case RESP.INT: return this.readInt();
case RESP.STR_SIMPLE: return this.readStrSimple();
case RESP.STR_VERBATIM: return this.readStrVerbatim();
case RESP.BOOL: return this.readBool();
case RESP.NULL: return reader.x += 2, null;
case RESP.INT:
return this.readInt();
case RESP.STR_SIMPLE:
return this.readStrSimple();
case RESP.STR_VERBATIM:
return this.readStrVerbatim();
case RESP.BOOL:
return this.readBool();
case RESP.NULL:
return (reader.x += 2), null;
}
throw new Error('UNKNOWN_TYPE');
}
Expand All @@ -48,13 +53,13 @@ export class RespDecoder<R extends IReader & IReaderResettable = IReader & IRead
const uint8 = reader.uint8;
const x = reader.x;
let number: number = 0;
for (let i = x;; i++) {
for (let i = x; ; i++) {
const c = uint8[i];
if (c === RESP.R) {
reader.x = i + 2;
return number;
}
number = (number * 10) + (c - 48);
number = number * 10 + (c - 48);
}
}

Expand All @@ -81,13 +86,13 @@ export class RespDecoder<R extends IReader & IReaderResettable = IReader & IRead
negative = true;
x++;
} else if (c === RESP.PLUS) x++;
for (let i = x;; i++) {
for (let i = x; ; i++) {
c = uint8[i];
if (c === RESP.R) {
reader.x = i + 2;
return negative ? -number : number;
}
number = (number * 10) + (c - 48);
number = number * 10 + (c - 48);
}
}

Expand Down

0 comments on commit 94f7441

Please sign in to comment.