<commit_before>function maxSafeInteger() {
  // Number.MAX_SAFE_INTEGER
  // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
  // Hard coded because Internet Explorer.
  return 9007199254740991
}

function allFilterables() {
  return document.querySelectorAll('.filter-list .filterable')
}

function updateAllFilterables(fn) {
  allFilterables().forEach(function(filterable) {
    fn(filterable)
  })
}

function show(filterable) {
  filterable.classList.add('filter-visible')
  filterable.classList.remove('filter-hidden')
}

function hide(filterable) {
  filterable.classList.add('filter-hidden')
  filterable.classList.remove('filter-visible')
}

function filters(filterable) {
  return JSON.parse(filterable.dataset.filters) || []
}

function filterOfType(filterable, filterType) {
  return filters(filterable).find(function(filter) {
    return filter.type === filterType
  })
}
function filterTypes(filterable) {
  return filters(filterable).map(function(filter) {
    return filter.type
  })
}

function filterBy(filterType) {
  if (filterType === 'all') {
    updateAllFilterables(function(filterable) {<commit_msg>Handle JSON parse errors and supply a friendly warning<commit_after>function maxSafeInteger() {
  // Number.MAX_SAFE_INTEGER
  // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
  // Hard coded because Internet Explorer.
  return 9007199254740991
}

function allFilterables() {
  return document.querySelectorAll('.filter-list .filterable')
}

function updateAllFilterables(fn) {
  allFilterables().forEach(function(filterable) {
    fn(filterable)
  })
}

function show(filterable) {
  filterable.classList.add('filter-visible')
  filterable.classList.remove('filter-hidden')
}

function hide(filterable) {
  filterable.classList.add('filter-hidden')
  filterable.classList.remove('filter-visible')
}

function filters(filterable) {
  var parsedFilters = []
  try {
    parsedFilters = JSON.parse(filterable.dataset.filters)
  } catch (e) {
    if (e instanceof SyntaxError) {
      console.warn("Gauze: there's a problem with your filters: ")
      console.warn(filterable.innerHTML)
      console.warn(filterable.dataset.filters)
    } else {
      console.warn("Gauze: Error parsing filters")
      console.warn(filterable)
      console.warn(e)
    }
  }
  return parsedFilters
}

function filterOfType(filterable, filterType) {
  return filters(filterable).find(function(filter) {
    return filter.type === filterType
  })
}
function filterTypes(filterable) {
  return filters(filterable).map(function(filter) {
    return filter.type
  })
}

function filterBy(filterType) {
  if (filterType === 'all') {
    updateAllFilterables(function(filterable) {
{'fraction_non_alphanumeric': 0.12293906810035843, 'fraction_numerical': 0.011469534050179211, 'mean_word_length': 4.778467908902692, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2662462', 'n_tokens_mistral': 873, 'n_tokens_neox': 854, 'n_words': 139}