Support bigint types in Debug sidebar

This commit is contained in:
Nick O'Leary
2020-11-17 20:50:29 +00:00
parent f19ec5d9b6
commit 545dda166f
3 changed files with 18 additions and 2 deletions

View File

@@ -774,6 +774,12 @@ function encodeObject(msg,opts) {
data: value.toString()
}
}
} else if (typeof value === 'bigint') {
value = {
__enc__: true,
type: 'bigint',
data: value.toString()
}
} else if (value && value.constructor) {
if (value.type === "Buffer") {
value.__enc__ = true;
@@ -808,6 +814,13 @@ function encodeObject(msg,opts) {
} else if (msgType === "number") {
msg.format = "number";
msg.msg = msg.msg.toString();
} else if (msgType === "bigint") {
msg.format = "bigint";
msg.msg = {
__enc__: true,
type: 'bigint',
data: msg.msg.toString()
};
} else if (msg.msg === null || msgType === "undefined") {
msg.format = (msg.msg === null)?"null":"undefined";
msg.msg = "(undefined)";