aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-04-03 07:29:53 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-04-03 07:29:53 +0800
commit97d6b0bab8c064c82b7f8eb2247fe00b5cdc2be6 (patch)
tree440ceadb6136051e0b43e171daaa0141632d1157
parent607fc788e378c62ceea72dbc536da0b484323a44 (diff)
parent1f122626be082055380b2b2bc8440d0a319be4cc (diff)
downloaddexon-97d6b0bab8c064c82b7f8eb2247fe00b5cdc2be6.tar
dexon-97d6b0bab8c064c82b7f8eb2247fe00b5cdc2be6.tar.gz
dexon-97d6b0bab8c064c82b7f8eb2247fe00b5cdc2be6.tar.bz2
dexon-97d6b0bab8c064c82b7f8eb2247fe00b5cdc2be6.tar.lz
dexon-97d6b0bab8c064c82b7f8eb2247fe00b5cdc2be6.tar.xz
dexon-97d6b0bab8c064c82b7f8eb2247fe00b5cdc2be6.tar.zst
dexon-97d6b0bab8c064c82b7f8eb2247fe00b5cdc2be6.zip
Merge pull request #633 from debris/prototype_functions
printing object prototype functions in geth console
-rw-r--r--jsre/pp_js.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/jsre/pp_js.go b/jsre/pp_js.go
index 0b22afe6d..3c0de37e5 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,18 @@ function pp(object, indent) {
return str;
}
+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;
+};
+
var isBigNumber = function (object) {
return typeof BigNumber !== 'undefined' && object instanceof BigNumber;
};
-
function prettyPrint(/* */) {
var args = arguments;
var ret = "";