mirror of
https://github.com/fluencelabs/assemblyscript-json
synced 2025-03-14 18:50:53 +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");
|
||||
if (byte == '"'.charCodeAt(0)) {
|
||||
let s = String.fromUTF8(this.state.buffer.buffer.data + savedIndex, this.state.readIndex - savedIndex - 1);
|
||||
if (stringParts != null) {
|
||||
stringParts.push(s);
|
||||
return stringParts.join("");
|
||||
} else {
|
||||
if (stringParts == null) {
|
||||
return s;
|
||||
}
|
||||
stringParts.push(s);
|
||||
return stringParts.join("");
|
||||
} else if (byte == "\\".charCodeAt(0)) {
|
||||
if (stringParts == null) {
|
||||
stringParts = new Array<string>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user