dump.js revision bf84ae48e272b3ddc103e8da28cc9ed7f30a9ba2
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Returns a simple string representation of the object or array.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Other types of objects will be returned unprocessed. Arrays
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * are expected to be indexed. Use object notation for
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * associative arrays.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * If included, the dump method is added to the YUI instance.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * @module dump
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync var L=Y.Lang, OBJ='{...}', FUN='f(){...}', COMMA=', ', ARROW=' => ',
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * The following methods are added to the YUI instance
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * @class YUI~dump
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Returns a simple string representation of the object or array.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * Other types of objects will be returned unprocessed. Arrays
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * are expected to be indexed. Use object notation for
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * associative arrays.
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * @TODO dumping a window is causing an unhandled exception in
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * This method is in the 'dump' module, which is not bundled with
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * the core YUI object
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * @method dump
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * @param o {object} The object to dump
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * @param d {int} How deep to recurse child objects, default 3
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync * @return {string} the dump result
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync dump = function(o, d) {
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync // Cast non-objects to string
b9a21c3c91c47e090316e28d759194e46628ed49vboxsync // Skip dates because the std toString is what we want
if (!L.isObject(o)) {
return FUN;
if (L.isObject(o[i])) {
s.push(o[i]);
s.pop();
if (o.hasOwnProperty(i)) {
if (L.isObject(o[i])) {
s.push(o[i]);
s.pop();