I hate to chime in without any real solid advice, but you asked me if I could look at it so, here it goes:
As far as what this code is doing, I have no clue. If you are simply wanting to setup an if condition to determine whether or not to bypass or trigger a portion of code, then that I can help with..
if(VARNAME){
CODE TO FIRE IF VAR HAS A VALUE
}
In order for this to work properly you must first obtain the variable. Depending on your setup, this can be several ways. I think the best way to do this with Appery, if possible, is to have your variable be a Local Storage Variable, then referencing it is as simple as:
var stor = Apperyio.storage.STORAGENAME.get("$['VARNAME']");
I hope your issue can be solved that easily, but I have a feeling it is not that simple. Sorry if I cannot help you here.