d-utils
Version:
d-utils
18 lines (17 loc) • 518 B
JavaScript
/**
* d-utils version: 4.0.3
* by ifmiss
*/
;
/**
* @description 检索数据类型并返回数据类型名称 object array string undefined bool number null 等等...
* @param { Any } data 要判断的数据
* @example
* checkType('1') // string
* @example
* checkType({}) // object
* @example
* checkType([]) // array
* @example
* checkType(localStorage) // storage
*/module.exports=function(t){return Object.prototype.toString.call(t).match(/\[object (.*?)\]/)[1].toLowerCase()};