Created
October 4, 2016 01:23
-
-
Save cicorias/55e7a392b1331f5c566797394d1d54e8 to your computer and use it in GitHub Desktop.
an Is empty js test in TypeScript
This file contains hidden or 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
export function isEmpty(obj: any): boolean { | |
if (obj === null | |
|| obj === undefined | |
|| (obj.length !== undefined && obj.length === 0) | |
|| Object.keys(obj).length === 0) { | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment