Last active
September 28, 2021 21:50
-
-
Save VinnyFonseca/5748697 to your computer and use it in GitHub Desktop.
Empty Object Check
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
function isEmpty(obj) { | |
return ( | |
(typeof obj == 'undefined' || obj === null || obj === '') | |
|| (typeof obj == 'number' && isNaN(obj)) | |
|| (obj instanceof Date && isNaN(Number(obj))) | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment