I am working on an app we inherited from a previous vendor and many places in the client side javascript I see something like this:
if (self.DESIGNEE_TYPE_SCREEN_ROUTE_REGEX.test(url)) {
goToSelectDesigneeType.call(self);
} else if (self.FUNCTION_CODES_SCREEN_ROUTE_REGEX.test(url)) {
goToSelectFunctionCodes.call(self);
} else if (self.DISCIPLINE_SCREEN_ROUTE_REGEX.test(url)) {
goToSelectDiscipline.call(self);
} else {
goToSelectDesigneeType.call(self);
} else ...
This is used to to go to the next step in a workflow, and it works fine but something about it just does not sit right with me. Is this pretty common, or is there a better way to do the same thing?