mirror of
https://github.com/fluencelabs/assemblyscript-json
synced 2025-05-11 15:01:48 +00:00
Use early return to make code a bit more readable
This commit is contained in:
parent
9b4431d73c
commit
1aca8f6b4c
@ -202,12 +202,11 @@ export class JSONDecoder<JSONHandlerT extends JSONHandler> {
|
|||||||
assert(byte >= 0x20, "Unexpected control character");
|
assert(byte >= 0x20, "Unexpected control character");
|
||||||
if (byte == '"'.charCodeAt(0)) {
|
if (byte == '"'.charCodeAt(0)) {
|
||||||
let s = String.fromUTF8(this.state.buffer.buffer.data + savedIndex, this.state.readIndex - savedIndex - 1);
|
let s = String.fromUTF8(this.state.buffer.buffer.data + savedIndex, this.state.readIndex - savedIndex - 1);
|
||||||
if (stringParts != null) {
|
if (stringParts == null) {
|
||||||
stringParts.push(s);
|
|
||||||
return stringParts.join("");
|
|
||||||
} else {
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
stringParts.push(s);
|
||||||
|
return stringParts.join("");
|
||||||
} else if (byte == "\\".charCodeAt(0)) {
|
} else if (byte == "\\".charCodeAt(0)) {
|
||||||
if (stringParts == null) {
|
if (stringParts == null) {
|
||||||
stringParts = new Array<string>();
|
stringParts = new Array<string>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user