<commit_before>// @flow
import Navigation from '../model/Navigation'
import QueryString from 'qs'
import transformNavigation from './transformNavigation'

export default transformNavigation(navigation => {
  const { to } = navigation
  if (to && typeof to.search === 'string' && to.search.length > 1) {
    return new Navigation({
      ...navigation,
      to: { ...to, query: QueryString.parse(to.search.substr(1)) }
    })
  }
  return navigation
})
<commit_msg>Making sure Navigation query is always set to empty object by default.<commit_after>// @flow
import Navigation from '../model/Navigation'
import QueryString from 'qs'
import transformNavigation from './transformNavigation'

export default transformNavigation(navigation => {
  const { to } = navigation
  
  if (to) {
    const query = typeof to.search === 'string' && to.search.length > 1
      ? QueryString.parse(to.search.substr(1))
      : {}

    return new Navigation({
      ...navigation,
      to: { ...to, query }
    })
  }

  return navigation
})

{'fraction_non_alphanumeric': 0.13365853658536586, 'fraction_numerical': 0.003902439024390244, 'mean_word_length': 3.2572614107883817, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3872146', 'n_tokens_mistral': 288, 'n_tokens_neox': 277, 'n_words': 87}