mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-23 13:43:51 +08:00
18 lines
441 B
JavaScript
18 lines
441 B
JavaScript
|
/**
|
||
|
* 判断是否为空
|
||
|
*/
|
||
|
module.exports.validatenull = (val) => {
|
||
|
if (typeof val == 'boolean') {
|
||
|
return false;
|
||
|
}
|
||
|
if (val instanceof Array) {
|
||
|
if (val.length == 0) return true;
|
||
|
} else if (val instanceof Object) {
|
||
|
if (JSON.stringify(val) === '{}') return true;
|
||
|
} else {
|
||
|
if (val == 'null' || val == null || val == 'undefined' || val == undefined || val == '') return true;
|
||
|
return false;
|
||
|
}
|
||
|
return false;
|
||
|
};
|