<commit_before>import { document } from 'global';
import qs from 'qs';

export const getQueryParams = () => {
  return qs.parse(document.location.search, { ignoreQueryPrefix: true });
};

export const getQueryParam = key => {
  const params = getQueryParams();
  return params[key];
};<commit_msg>Safe document.location access<commit_after>import { document } from 'global';
import qs from 'qs';

export const getQueryParams = () => {
  // document.location is not defined in react-native
  if (document && document.location && document.location.search) {
    return qs.parse(document.location.search, { ignoreQueryPrefix: true });
  }
  return {};
};

export const getQueryParam = key => {
  const params = getQueryParams();
  return params[key];
};
{'fraction_non_alphanumeric': 0.13733333333333334, 'fraction_numerical': 0.0, 'mean_word_length': 4.604477611940299, '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': '7228126', 'n_tokens_mistral': 216, 'n_tokens_neox': 215, 'n_words': 61}