diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-04-03 07:47:05 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-04-03 07:47:05 +0800 |
commit | 24c8fdc1d06e7404992553aea85c74ee2239f397 (patch) | |
tree | 25d080d8cf9434476ce9c55d9ca5379f2e6b2024 | |
parent | 1f122626be082055380b2b2bc8440d0a319be4cc (diff) | |
download | dexon-24c8fdc1d06e7404992553aea85c74ee2239f397.tar dexon-24c8fdc1d06e7404992553aea85c74ee2239f397.tar.gz dexon-24c8fdc1d06e7404992553aea85c74ee2239f397.tar.bz2 dexon-24c8fdc1d06e7404992553aea85c74ee2239f397.tar.lz dexon-24c8fdc1d06e7404992553aea85c74ee2239f397.tar.xz dexon-24c8fdc1d06e7404992553aea85c74ee2239f397.tar.zst dexon-24c8fdc1d06e7404992553aea85c74ee2239f397.zip |
do not print Plain Object prototype fields in geth console
-rw-r--r-- | jsre/pp_js.go | 14 |
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) { |