diff --git a/assembly/deserialize/simple/bool.ts b/assembly/deserialize/simple/bool.ts index 641a144..1f29027 100644 --- a/assembly/deserialize/simple/bool.ts +++ b/assembly/deserialize/simple/bool.ts @@ -3,7 +3,7 @@ import { CHAR_F, CHAR_T } from "../../custom/chars"; export function deserializeBoolean(srcStart: usize, srcEnd: usize): boolean { const srcSize = srcEnd - srcStart; const firstChar = load(srcStart); - if (srcSize == 4 && firstChar == CHAR_T && load(srcStart) == 28429475166421108) return true; - else if (srcSize == 5 && firstChar == CHAR_F && load(srcSize, 2) == 28429466576093281) return false; + if (firstChar == CHAR_T && load(srcStart) == 28429475166421108) return true; + else if (firstChar == CHAR_F && load(srcSize, 2) == 28429466576093281) return false; return false; //ERROR(`Expected to find boolean, but found "${data.slice(0, 100)}" instead!`); -} +} \ No newline at end of file diff --git a/assembly/index.ts b/assembly/index.ts index a3a25be..5214438 100644 --- a/assembly/index.ts +++ b/assembly/index.ts @@ -48,7 +48,7 @@ export namespace JSON { * @returns string */ export function stringify(data: T, out: string | null = null): string { - if (isBoolean(data)) { + if (isBoolean()) { if (out) { if (data == true) { out = changetype(__renew(changetype(out), 8)); @@ -60,7 +60,7 @@ export namespace JSON { } return out; } - return out ? "true" : "false"; + return data ? "true" : "false"; } else if (isInteger() && nameof() == "usize" && data == 0) { if (out) { out = changetype(__renew(changetype(out), 8));