<commit_before>function identity(i) {
  return i;
}

function toNativeType(str) {
  if (str === null || str === 'null') {
    return null;
  } else if (str === 'true') {
    return true;
  } else if (str === 'false') {
    return false;
  } else if (str === undefined || str === 'undefined') {
    return undefined;
  } else if (str === '' || Number.isNaN(str)) {
    return str;
  }
  return parseFloat(str);
}

function extractURLParameters(
  castToNativeType = true,
  query = window.location.search
) {
  const summary = {};
  const convert = castToNativeType ? toNativeType : identity;
  const queryTokens = (query || '')
    .replace(/#.*/, '') // remove hash query
    .replace('?', '') // Remove ? from the head
    .split('&'); // extract token pair

  queryTokens.forEach((token) => {
    const [key, value] = token.split('=').map((s) => decodeURIComponent(s));
    if (key) {
      summary[key] = value ? convert(value) : true;
    }<commit_msg>fix(URLExtract): Native type convertion issue<commit_after>function identity(i) {
  return i;
}

function toNativeType(str) {
  if (str === null || str === 'null') {
    return null;
  } else if (str === 'true') {
    return true;
  } else if (str === 'false') {
    return false;
  } else if (str === undefined || str === 'undefined') {
    return undefined;
  } else if (str === '' || Number.isNaN(Number(str))) {
    return str;
  }
  return Number(str);
}

function extractURLParameters(
  castToNativeType = true,
  query = window.location.search
) {
  const summary = {};
  const convert = castToNativeType ? toNativeType : identity;
  const queryTokens = (query || '')
    .replace(/#.*/, '') // remove hash query
    .replace('?', '') // Remove ? from the head
    .split('&'); // extract token pair

  queryTokens.forEach((token) => {
    const [key, value] = token.split('=').map((s) => decodeURIComponent(s));
    if (key) {
      summary[key] = value ? convert(value) : true;
    }
{'fraction_non_alphanumeric': 0.18307692307692308, 'fraction_numerical': 0.0, 'mean_word_length': 3.159914712153518, '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': '6424614', 'n_tokens_mistral': 619, 'n_tokens_neox': 623, 'n_words': 168}