aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-03 17:28:32 +0800
committerobscuren <geffobscura@gmail.com>2015-04-03 17:28:32 +0800
commit29a9c6bedd39f3432f8031475646ec151ca5caa5 (patch)
treedb3aafab2a636c2bd141a3d2ea37459d72963b84
parentc59c826ab45e2e999dc9a173e5bce9727754f544 (diff)
parentea606733ebce327ab3d0f183a6976fc82112661f (diff)
downloaddexon-29a9c6bedd39f3432f8031475646ec151ca5caa5.tar.gz
dexon-29a9c6bedd39f3432f8031475646ec151ca5caa5.tar.zst
dexon-29a9c6bedd39f3432f8031475646ec151ca5caa5.zip
Merge branch 'develop' of github.com-obscure:ethereum/go-ethereum into develop
-rw-r--r--jsre/pp_js.go25
1 files changed, 22 insertions, 3 deletions
diff --git a/jsre/pp_js.go b/jsre/pp_js.go
index 0b22afe6d..2badb90e7 100644
--- a/jsre/pp_js.go
+++ b/jsre/pp_js.go
@@ -30,8 +30,8 @@ function pp(object, indent) {
} else if(typeof(object) === "object") {
str += "{\n";
indent += " ";
- var last = Object.getOwnPropertyNames(object).pop()
- Object.getOwnPropertyNames(object).forEach(function (k) {
+ var last = getFields(object).pop()
+ getFields(object).forEach(function (k) {
str += indent + k + ": ";
try {
str += pp(object[k], indent);
@@ -63,11 +63,30 @@ function pp(object, indent) {
return str;
}
+var redundantFields = [
+ 'valueOf',
+ 'toString',
+ 'toLocaleString',
+ 'hasOwnProperty',
+ 'isPrototypeOf',
+ 'propertyIsEnumerable',
+ 'constructor'
+];
+
+var getFields = function (object) {
+ var result = Object.getOwnPropertyNames(object);
+ if (object.constructor && object.constructor.prototype) {
+ result = result.concat(Object.getOwnPropertyNames(object.constructor.prototype));
+ }
+ return result.filter(function (field) {
+ return redundantFields.indexOf(field) === -1;
+ });
+};
+
var isBigNumber = function (object) {
return typeof BigNumber !== 'undefined' && object instanceof BigNumber;
};
-
function prettyPrint(/* */) {
var args = arguments;
var ret = "";