isEmptyObject.js 277 B

12345678910111213
  1. /**
  2. *
  3. * @desc 判断`obj`是否为空
  4. * @param {Object} obj
  5. * @return {Boolean}
  6. */
  7. function isEmptyObject(obj) {
  8. if (!obj || typeof obj !== 'object' || Array.isArray(obj))
  9. return false
  10. return !Object.keys(obj).length
  11. };
  12. module.exports = isEmptyObject;