You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

isEmpty.js 372B

1 anno fa
12345678910111213141516171819
  1. /**
  2. * Checks if a value is empty.
  3. */
  4. function isEmpty(value) {
  5. if (Array.isArray(value)) {
  6. return value.length === 0
  7. } else if (typeof value === 'object') {
  8. if (value) {
  9. for (const _ in value) {
  10. return false
  11. }
  12. }
  13. return true
  14. } else {
  15. return !value
  16. }
  17. }
  18. export default isEmpty