function isString(value){ return 'string' == typeof value } function isObject(value){ return 'object' == typeof value } function isArray(value){ return 'array' == typeof value } //是否合法类型 function isLawfulType(type,value){ let valye_type = typeof value if(isString(type)){ type = type.toLowerCase() return type == valye_type } if(isArray(type)){ return type.indexOf(valye_type)?true:false; } return false } function isFunction(value){ return 'function' == typeof value } export {isObject,isString,isArray,isLawfulType,isFunction}