expressServer/utils/StringUtil.js
LingandRX 8741389ef5 refactor: 优化项目结构和代码
- 更新 .gitignore 文件,排除 Idea 项目配置
- 移除 vuepress 缓存目录
- 优化 app.js 中的错误处理和状态码导入- 调整 CORS 配置,移除未使用的 allowdHeaders
- 更新 hashUtils.js 中的密码处理函数
- 优化 index.js 中的路由定义
- 更新 mongodbConfig.js 中的数据库连接逻辑
- 升级 express到 5.0.0- 更新 mongoose 到 8.7.1
2025-01-01 12:21:43 +08:00

20 lines
375 B
JavaScript

/**
* 判断是否为空
* @param {*} obj 任意值
* @returns {Boolean} obj是否为空
*/
exports.isNotEmpty = function (obj) {
if (obj === null || obj === undefined || Object.keys(obj).length === 0) {
return false
}
if (obj instanceof String) {
return obj !== ''
}
if (obj instanceof Array) {
return Array.length(obj) !== 0
}
return true
}