Created
March 26, 2018 00:34
-
-
Save azza85/e004c916737bfb31a47849f064f9ddfb to your computer and use it in GitHub Desktop.
check if item property is available and not empty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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