Created
November 12, 2013 19:28
-
-
Save JoeRobich/7437148 to your computer and use it in GitHub Desktop.
An API I was calling into was returning empty objects in addition to null. I made this helper function to simplify the handling logic.
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
public static function isNullOrEmpty(object:Object):Boolean | |
{ | |
if (!object) | |
return true; | |
if (object is Array || | |
object is IList) | |
return !object.length; | |
for (var key:String in object) | |
return false; | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment