expressServer/utils/StringUtil.js

20 lines
453 B
JavaScript

/**
*
* @param {*} obj 任意值
* @returns true - obj不为空, false - obj为空
*/
exports.isNotEmpty = function (obj) {
if (obj === null || obj === undefined || Object.keys(obj).length === 0) {
return false;
}
if (obj instanceof String) {
return obj === '' ? false : true;
}
if (obj instanceof Array) {
return Array.length(obj) === 0 ? false : true;
}
console.log('111');
return true;
}