I seem to be using this test a lot
if( object && object !== \"null\" && object !== \"undefined\" ){ doSomething(); }
on
This should work without any issue.
if(object){ // checks for null and undefined doSomething(); }