<commit_before>function parseFields (payload) {
  if (Array.isArray(payload)) {
    payload.forEach(parseFields);
    return;
  }

  if (typeof payload === 'object' && payload.hasOwnProperty('fields')) {
    payload.fields = JSON.parse(payload.fields);
  }
}

export default parseFields;<commit_msg>Update parseFields to handle `date` property<commit_after>var fields = ['fields', 'date'];

function parseFields (payload) {
  var i;

  if (Array.isArray(payload)) {
    payload.forEach(parseFields);
    return;
  }

  if (typeof payload !== 'object') {
    return;
  }

  for (i = 0; i !== fields.length; ++i) {
    if (payload.hasOwnProperty(fields[i])) {
      if (fields[i] === 'date') {
        payload[fields[i]] = new Date(payload[fields[i]]);
      } else {
        payload[fields[i]] = JSON.parse(payload[fields[i]]);
      }
    }
  }
}

export default parseFields;
{'fraction_non_alphanumeric': 0.1657142857142857, 'fraction_numerical': 0.001142857142857143, 'mean_word_length': 3.4923076923076923, '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': '5208393', 'n_tokens_mistral': 284, 'n_tokens_neox': 281, 'n_words': 59}