<commit_before>import Ember from 'ember'
const {Helper, get} = Ember

export function getTypedComponentName ([componentKeyNamesForTypes, itemTypeKey, model, componentKey, defaultKey]) {
  const type = get(model, itemTypeKey)

  // Get the set of key names for this type (ex. item, itemExpansion, etc.)
  let componentKeyNames = get(componentKeyNamesForTypes, type)

  // If there are no key names for this type, fall back to default set of key names
  if (!componentKeyNames) {
    componentKeyNames = get(componentKeyNamesForTypes, defaultKey)
  }

  return get(componentKeyNames, componentKey)
}

export default Helper.helper(getTypedComponentName)<commit_msg>Fix bug in helper where undefined could get passed as argument to Ember.get<commit_after>import Ember from 'ember'
const {Helper, get} = Ember

export function getTypedComponentName ([componentKeyNamesForTypes, itemTypeKey, model, componentKey, defaultKey]) {
  const type = get(model, itemTypeKey)

  // Get the set of key names for this type (ex. item, itemExpansion, etc.)
  let componentKeyNames = type ? get(componentKeyNamesForTypes, type) : undefined

  // If there are no key names for this type, fall back to default set of key names
  if (!componentKeyNames) {
    componentKeyNames = get(componentKeyNamesForTypes, defaultKey)
  }

  return get(componentKeyNames, componentKey)
}

export default Helper.helper(getTypedComponentName)
{'fraction_non_alphanumeric': 0.07758007117437722, 'fraction_numerical': 0.0, 'mean_word_length': 5.221238938053097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7236702', 'n_tokens_mistral': 396, 'n_tokens_neox': 388, 'n_words': 143}