2 * Affiche un objet quelconque sur la sortie du navigateur.
4 var dumpObj = function(obj
, name
)
6 if (typeof(dump
) == "undefined")
9 dump("---" + (name
== undefined ? "" : " : " + name
) + "\n")
14 var obj2text = function(obj
, curDepth
)
16 if (curDepth
== undefined)
25 else if (typeof(obj
) == "string")
27 acc
+= "\"" + obj
+ "\""
29 else if (obj
.length
!= undefined) // array
34 for (; i
< obj
.length
; i
++)
36 if (i
!= 0) acc
+= ","
37 acc
+= "\n" + indent(curDepth
+ 1, obj2text(obj
[i
], curDepth
+ 1))
40 acc
+= (i
== 0 ? "]" : "\n" + indent(curDepth
, "]"))
42 else if (typeof(obj
) == "object")
48 if (i
!= 0) acc
+= ","
49 acc
+= "\n" + indent(curDepth
+ 1, prop
+ " : " + obj2text(obj
[prop
], curDepth
+ 1))
52 acc
+= "\n" + indent(curDepth
, "}")
54 else if (typeof(obj
) == "function")
66 var indent = function(depth
, text
)
69 for (var i
= 0; i
< depth
* 3; i
++)
71 return indentText
+ text