Skip to content

Instantly share code, notes, and snippets.

@JoeRobich
Created November 12, 2013 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoeRobich/7437148 to your computer and use it in GitHub Desktop.
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.
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