工具类

时间:2021-02-02 11:11:35   收藏:0   阅读:0
/**
* 判断是否是字符串
* @param target
*/
static isString(target: any) {
return target && typeof target == ‘string‘ && target.constructor == String;
}

/**
* 判断是否是对象
* @param target 对象
*/
static isObject(target: any) {
return target && typeof target == ‘object‘ && target.constructor == Object;
}

/**
* 判断是否是数组
* @param target 对象
*/
static isArray(target: any) {
return target && typeof target == ‘object‘ && target.constructor == Array;
}

/**
* 判断是否是数组
* @param target 对象
*/
static isFunction(target: any) {
return target && typeof target == ‘function‘;
}
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!