Skip to content

Instantly share code, notes, and snippets.

@cicorias
Created October 4, 2016 01:23
Show Gist options
  • Save cicorias/55e7a392b1331f5c566797394d1d54e8 to your computer and use it in GitHub Desktop.
Save cicorias/55e7a392b1331f5c566797394d1d54e8 to your computer and use it in GitHub Desktop.
an Is empty js test in TypeScript
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