js utils

iTypeOf [Function]

// Begin public util method /iTypeOf/
// 描述 : 返回给定参数的实例类型,以字符串形式
// 版本 : 0.1 fzb 2015-04-24
// 例子 : iTypeOf( 'fzb' );
// 目的 : 返回参数的实例类型
// 参数 :
// * input - 必须.
// 返回 : 字符串,共8种情况
// * String - 字符串
// * Number - 数字
// * Boolean - 布尔
// * Array - 数组
// * Object - 对象
// * Null - Null
// * Undefined - Undefined
// * Function - Function
function iTypeOf ( input ) {
  return Object.prototype.toString.call(input).match(/^\[object\s(.*)\]$/)[1];
}    
// End public util method /iTypeOf/  
View Code

 

posted @ 2015-04-24 15:13  Hi!张宝  阅读(176)  评论(0)    收藏  举报