Refactoring typeAheadCallbackCreator

- Rewrite if statement in order to make it easy to read
- Use _.each instead of $.each (consistency)