mirror of https://github.com/poanetwork/quorum.git
Merge pull request #625 from debris/nonenumerable
print nonenumerable properties of object in geth console && proper printing BigNumbers
This commit is contained in:
commit
7e13ee602e
|
@ -23,18 +23,28 @@ function pp(object, indent) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
str += " ]";
|
str += " ]";
|
||||||
|
} else if (object instanceof Error) {
|
||||||
|
str += "\033[31m" + "Error";
|
||||||
|
} else if (isBigNumber(object)) {
|
||||||
|
str += "\033[32m'" + object.toString(10) + "'";
|
||||||
} else if(typeof(object) === "object") {
|
} else if(typeof(object) === "object") {
|
||||||
str += "{\n";
|
str += "{\n";
|
||||||
indent += " ";
|
indent += " ";
|
||||||
var last = Object.keys(object).pop()
|
var last = Object.getOwnPropertyNames(object).pop()
|
||||||
for(var k in object) {
|
Object.getOwnPropertyNames(object).forEach(function (k) {
|
||||||
str += indent + k + ": " + pp(object[k], indent);
|
str += indent + k + ": ";
|
||||||
|
try {
|
||||||
|
str += pp(object[k], indent);
|
||||||
|
} catch (e) {
|
||||||
|
str += pp(e, indent);
|
||||||
|
}
|
||||||
|
|
||||||
if(k !== last) {
|
if(k !== last) {
|
||||||
str += ",";
|
str += ",";
|
||||||
}
|
}
|
||||||
str += "\n";
|
|
||||||
}
|
str += "\n";
|
||||||
|
});
|
||||||
str += indent.substr(2, indent.length) + "}";
|
str += indent.substr(2, indent.length) + "}";
|
||||||
} else if(typeof(object) === "string") {
|
} else if(typeof(object) === "string") {
|
||||||
str += "\033[32m'" + object + "'";
|
str += "\033[32m'" + object + "'";
|
||||||
|
@ -43,7 +53,7 @@ function pp(object, indent) {
|
||||||
} else if(typeof(object) === "number") {
|
} else if(typeof(object) === "number") {
|
||||||
str += "\033[31m" + object;
|
str += "\033[31m" + object;
|
||||||
} else if(typeof(object) === "function") {
|
} else if(typeof(object) === "function") {
|
||||||
str += "\033[35m[Function]";
|
str += "\033[35m[Function]";
|
||||||
} else {
|
} else {
|
||||||
str += object;
|
str += object;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +63,11 @@ function pp(object, indent) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isBigNumber = function (object) {
|
||||||
|
return typeof BigNumber !== 'undefined' && object instanceof BigNumber;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
function prettyPrint(/* */) {
|
function prettyPrint(/* */) {
|
||||||
var args = arguments;
|
var args = arguments;
|
||||||
var ret = "";
|
var ret = "";
|
||||||
|
|
Loading…
Reference in New Issue