aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-04-03 07:53:55 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-04-03 07:53:55 +0800
commitea606733ebce327ab3d0f183a6976fc82112661f (patch)
tree25d080d8cf9434476ce9c55d9ca5379f2e6b2024
parent97d6b0bab8c064c82b7f8eb2247fe00b5cdc2be6 (diff)
parent24c8fdc1d06e7404992553aea85c74ee2239f397 (diff)
downloaddexon-ea606733ebce327ab3d0f183a6976fc82112661f.tar
dexon-ea606733ebce327ab3d0f183a6976fc82112661f.tar.gz
dexon-ea606733ebce327ab3d0f183a6976fc82112661f.tar.bz2
dexon-ea606733ebce327ab3d0f183a6976fc82112661f.tar.lz
dexon-ea606733ebce327ab3d0f183a6976fc82112661f.tar.xz
dexon-ea606733ebce327ab3d0f183a6976fc82112661f.tar.zst
dexon-ea606733ebce327ab3d0f183a6976fc82112661f.zip
Merge pull request #636 from debris/prototype_functions
do not print Plain Object prototype fields in geth console
-rw-r--r--jsre/pp_js.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/jsre/pp_js.go b/jsre/pp_js.go
index 3c0de37e5..2badb90e7 100644
--- a/jsre/pp_js.go
+++ b/jsre/pp_js.go
@@ -63,12 +63,24 @@ 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;
+ return result.filter(function (field) {
+ return redundantFields.indexOf(field) === -1;
+ });
};
var isBigNumber = function (object) {