Skip to content

Instantly share code, notes, and snippets.

@azza85
Created March 26, 2018 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azza85/e004c916737bfb31a47849f064f9ddfb to your computer and use it in GitHub Desktop.
Save azza85/e004c916737bfb31a47849f064f9ddfb to your computer and use it in GitHub Desktop.
check if item property is available and not empty
const isEmpty = (prop) => {
return (
prop === null ||
prop === undefined ||
(prop.hasOwnProperty('length') && prop.length === 0) ||
(prop.constructor === Object && Object.keys(prop).length === 0)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment