Not Empty

notEmpty is the inverse of isEmpty. It exists so you don’t have to write a double negative like !isEmpty.


Check if a value is not empty

notEmpty is the opposite of isEmpty. It returns false for:

  • null and undefined
  • An empty string ('')
  • An empty array ([])
  • An empty object ({})
  • A Map, Set, File, Blob or URLSearchParams with nothing in it
main.js
// Before
if (!isEmpty(value)) {
// ...
}
main.js
// After
if (notEmpty(value)) {
// ...
}