When passing a string value to NBT.read(), the function should check that it's parsed root name value equals that of the string parsed in.
If one doesn't know what that string is when reading, they can set it to true, and it will only validate whether there is a root name, rather than what it actually is.
Right now, the unexpected handling is that passing a string for ReadOptions["rootName"] is no different than passing true.
import { read } from "nbtify";
declare const data: Uint8Array;
// detect the status of the root name for us
await read(data);
await read(data, {});
await read(data, { rootName: undefined });
// assert that it should have a root name
await read(data, { rootName: true });
// assert that it should not have a root name
await read(data, { rootName: false });
// assert that the root name should specifically be "hello world" (expected behavior, this needs to be added)
await read(data, { rootName: "hello world" });
When passing a string value to
NBT.read()
, the function should check that it's parsed root name value equals that of the string parsed in.If one doesn't know what that string is when reading, they can set it to
true
, and it will only validate whether there is a root name, rather than what it actually is.Right now, the unexpected handling is that passing a string for
ReadOptions["rootName"]
is no different than passingtrue
.