check if typeaheadSource is null before checking if is function or object