function (value) {
   if (value === undefined) return 'undefined';
   if (value === null) return 'null';

   // Look inside the array to determine the inner type.
   if (value instanceof Array) {
      if (!value.length) return 'Array(empty)';
      var innerType = undefined;
      for (var i = 0; i < value.length; i++) {
         type = getNameForValue(value[i]);
         if (innerType !== undefined && innerType !== type) {
            return 'Array(mixed)';
         }
         innerType = type;
      };
      return 'Array<' + innerType + '>';
   }

   if (value instanceof Function) {
      if (value.name) return value.name;
      return 'Anonymous function';
   }

   // Try and use the constructor to find the name of the type.
   if (value instanceof Object) {
      if (value.constructor) return value.constructor.name;
      return 'Object';
   }

   // No other way to determine the name of the type, just capitilize the typeof value.
   name = typeof value;
   return name[0].toUpperCase() + name.substring(1);
}
function (value) {
   if (value === undefined) return 'undefined';
   if (value === null) return 'null';

   
   if (value instanceof Array) {
      if (!value.length) return 'Array(empty)';
      var innerType = undefined;
      for (var i = 0; i < value.length; i++) {
         type = getNameForValue(value[i]);
         if (innerType !== undefined && innerType !== type) {
            return 'Array(mixed)';
         }
         innerType = type;
      };
      return 'Array<' + innerType + '>';
   }

   if (value instanceof Function) {
      if (value.name) return value.name;
      return 'Anonymous function';
   }

   
   if (value instanceof Object) {
      if (value.constructor) return value.constructor.name;
      return 'Object';
   }

   
   name = typeof value;
   return name[0].toUpperCase() + name.substring(1);
}
function ( value ) { if ( value === undefined ) return 'undefined' ; if ( value === null ) return 'null' ; // Look inside the array to determine the inner type. if ( value instanceof Array ) { if ( ! value . length ) return 'Array(empty)' ; var innerType = undefined ; for ( var i = 0 ; i < value . length ; i ++ ) { type = getNameForValue ( value [ i ] ) ; if ( innerType !== undefined && innerType !== type ) { return 'Array(mixed)' ; } innerType = type ; } ; return 'Array<' + innerType + '>' ; } if ( value instanceof Function ) { if ( value . name ) return value . name ; return 'Anonymous function' ; } // Try and use the constructor to find the name of the type. if ( value instanceof Object ) { if ( value . constructor ) return value . constructor . name ; return 'Object' ; } // No other way to determine the name of the type, just capitilize the typeof value. name = typeof value ; return name [ 0 ] . toUpperCase ( ) + name . substring ( 1 ) ; }
Gets the pretty name for the type of the value.
@param {?} value
@return {string}
Gets the pretty name for the type of the value .