mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-02-24 21:59:13 +08:00
51 lines
793 B
JavaScript
51 lines
793 B
JavaScript
/**
|
|
* 字符串工具类
|
|
*
|
|
* add by 吴学文 2020-09-25
|
|
*/
|
|
|
|
/**
|
|
* 判断是否为空
|
|
* @param {Object} _value 字符串
|
|
*/
|
|
export function isEmpty(_value) {
|
|
let type = typeof _value;
|
|
|
|
switch (type) {
|
|
case 'number':
|
|
if (isFinite(_value)) {
|
|
if (_value == 0) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
} else {
|
|
return true;
|
|
}
|
|
case 'object':
|
|
for (let i in _value) {
|
|
return false;
|
|
}
|
|
return true;
|
|
case 'string':
|
|
if (_value.length == 0) {
|
|
return true;
|
|
} else {
|
|
return false
|
|
}
|
|
default:
|
|
return true
|
|
}
|
|
}
|
|
|
|
export function isNull(_value) {
|
|
if (typeof _value == "undefined" || _value == null || _value == "") {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
export function isNotNull(_value) {
|
|
return !isNull(_value);
|
|
} |