Global.Object.prototype.dump (recursive)
print the contents of an object for debugging

  • Parameter Object:
    the object to dump
  • Parameter Boolean:
    recursive flag (if true, dump child objects, too)
Sourcecode in /home/hannes/helma/modules/core/Object.js:
64:   Object.prototype.dump = function(recursive) {
65:       var beginList = "<ul>";
66:       var endList = "</ul>";
67:       var beginItem = "<li>";
68:       var endItem = "</li>";
69:       var beginKey = "<strong>";
70:       var endKey = ":</strong> ";
71:       res.write(beginList);
72:       for (var p in this) {
73:          res.write(beginItem);
74:          res.write(beginKey);
75:          res.write(p);
76:          res.write(endKey);
77:          if (recursive && typeof this[p] == "object") {
78:              var recurse = true;
79:              var types = [Function, Date, String, Number];
80:              for (var i in types) {
81:                  if (this[p] instanceof types[i]) {
82:                      recurse = false
83:                      break;
84:                  }
85:              }
86:              if (recurse == true)
87:                  this[p].dump(true);
88:              else {
89:                  res.write(this[p].toSource());
90:              }
91:          } else if (this[p]) {
92:              res.write(encode(this[p].toSource()));
93:          }
94:          res.write(endItem);
95:      }
96:      res.write(endList);
97:      return;
98:  }