mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Support bigint types in Debug sidebar
This commit is contained in:
parent
f19ec5d9b6
commit
545dda166f
@ -773,6 +773,9 @@ RED.clipboard = (function() {
|
||||
// representation or null
|
||||
return null;
|
||||
}
|
||||
if (value.type === 'bigint') {
|
||||
return value.data.toString();
|
||||
}
|
||||
if (value.type === 'undefined') {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ RED.utils = (function() {
|
||||
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-meta"></span>').text('array['+value.length+']');
|
||||
} else if (value.hasOwnProperty('type') && value.type === 'function') {
|
||||
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-meta"></span>').text('function');
|
||||
} else if (value.hasOwnProperty('type') && value.type === 'number') {
|
||||
} else if (value.hasOwnProperty('type') && (value.type === 'number' || value.type === 'bigint')) {
|
||||
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-number"></span>').text(value.data);
|
||||
} else {
|
||||
result = $('<span class="red-ui-debug-msg-object-value red-ui-debug-msg-type-meta">object</span>');
|
||||
@ -352,7 +352,7 @@ RED.utils = (function() {
|
||||
$('<span class="red-ui-debug-msg-type-null">'+obj+'</span>').appendTo(entryObj);
|
||||
} else if (obj.__enc__ && obj.type === 'undefined') {
|
||||
$('<span class="red-ui-debug-msg-type-null">undefined</span>').appendTo(entryObj);
|
||||
} else if (obj.__enc__ && obj.type === 'number') {
|
||||
} else if (obj.__enc__ && (obj.type === 'number' || obj.type === 'bigint')) {
|
||||
e = $('<span class="red-ui-debug-msg-type-number red-ui-debug-msg-object-header"></span>').text(obj.data).appendTo(entryObj);
|
||||
} else if (typeHint === "function" || (obj.__enc__ && obj.type === 'function')) {
|
||||
e = $('<span class="red-ui-debug-msg-type-meta red-ui-debug-msg-object-header"></span>').text("function").appendTo(entryObj);
|
||||
|
13
packages/node_modules/@node-red/util/lib/util.js
vendored
13
packages/node_modules/@node-red/util/lib/util.js
vendored
@ -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)";
|
||||
|
Loading…
Reference in New Issue
Block a user