B2G/gecko/toolkit/devtools/Console.jsm
/**
 * A single line stringification of an object designed for use by humans
 *
 * @param {any} aThing
 *        The object to be stringified
 * @return {string}
 *        A single line representation of aThing, which will generally be at
 *        most 80 chars long
 */
A single line stringification of an object designed for use by humans
@param {any} aThing
The object to be stringified
@return {string}
A single line representation of aThing, which will generally be at
most 80 chars long
A single line stringification of an object designed for use by humans @param { any } aThing The object to be stringified @return { string } A single line representation of aThing which will generally be at most 80 chars long
function stringify(aThing) {
  if (aThing === undefined) {
    return "undefined";
  }
  if (aThing === null) {
    return "null";
  }
  if (typeof aThing == "object") {
    let type = getCtorName(aThing);
    if (aThing instanceof Components.interfaces.nsIDOMNode && aThing.tagName) {
      return debugElement(aThing);
    }
    type = (type == "Object" ? "" : type + " ");
    let json;
    try {
      json = JSON.stringify(aThing);
    }
    catch (ex) {
      json = "{" + Object.keys(aThing).join(":..,") + ":.., " + "}";
    }
    return type + fmt(json, 50, 0);
  }
  if (typeof aThing == "function") {
    return fmt(aThing.toString().replace(/\s+/g, " "), 80, 0);
  }
  let str = aThing.toString().replace(/\n/g, "|");
  return fmt(str, 80, 0);
}
function stringify ( aThing ) { if ( aThing === undefined ) { return "undefined" ; } if ( aThing === null ) { return "null" ; } if ( typeof aThing == "object" ) { let type = getCtorName ( aThing ) ; if ( aThing instanceof Components . interfaces . nsIDOMNode && aThing . tagName ) { return debugElement ( aThing ) ; } type = ( type == "Object" ? "" : type + " " ) ; let json ; try { json = JSON . stringify ( aThing ) ; } catch ( ex ) { json = "{" + Object . keys ( aThing ) . join ( ":..," ) + ":.., " + "}" ; } return type + fmt ( json , 50 , 0 ) ; } if ( typeof aThing == "function" ) { return fmt ( aThing . toString ( ) . replace ( / \s+ / g , " " ) , 80 , 0 ) ; } let str = aThing . toString ( ) . replace ( / \n / g , "|" ) ; return fmt ( str , 80 , 0 ) ; }
A single line stringification of an object designed for use by humans
 @param {any} aThing
        The object to be stringified
 @return {string}
        A single line representation of aThing, which will generally be at
        most 80 chars long
A single line stringification of an object designed for use by humans @param { any } aThing The object to be stringified @return { string } A single line representation of aThing which will generally be at most 80 chars long
// Can't use a real ellipsis here, because cmd.exe isn't unicode-enabled