<commit_before>function parseLog(value) {
  var data = {};
  
  var lines = value.match(/[^\r\n]+/g);
  
  var traceLines = extractTrace(lines);
  if(traceLines) data.stack = traceLines;
  
  var actual = extractSection('Actual: ',lines);
  if(actual.length) data.actual = actual;
  
  var expected = extractSection('Expected: ',lines);
  if(expected.length) data.expected = expected;
  
  if(lines.length) data.description = lines;
  
  return data;
}

function extractTrace(lines) {
  var traceLines = [];
  while(lines.length && lines[lines.length - 1].trim().indexOf('at ') === 0) {
     traceLines.push(lines.pop());
  }
  return traceLines;
}

function extractSection(text,lines) {
  for(var x = 0;x < lines.length;x++) {
    if(lines[x].indexOf(text) === 0) {
      lines[x] = lines[x].substr(text.length);
      return lines.splice(x);
    }
  }
  return [];  
}

module.exports = {
  parseLog: parseLog
};<commit_msg>no need to do single exports<commit_after>function parseLog(value) {
  var data = {};
  
  var lines = value.match(/[^\r\n]+/g);
  
  var traceLines = extractTrace(lines);
  if(traceLines) data.stack = traceLines;
  
  var actual = extractSection('Actual: ',lines);
  if(actual.length) data.actual = actual;
  
  var expected = extractSection('Expected: ',lines);
  if(expected.length) data.expected = expected;
  
  if(lines.length) data.description = lines;
  
  return data;
}

function extractTrace(lines) {
  var traceLines = [];
  while(lines.length && lines[lines.length - 1].trim().indexOf('at ') === 0) {
     traceLines.push(lines.pop());
  }
  return traceLines;
}

function extractSection(text,lines) {
  for(var x = 0;x < lines.length;x++) {
    if(lines[x].indexOf(text) === 0) {
      lines[x] = lines[x].substr(text.length);
      return lines.splice(x);
    }
  }
  return [];  
}

exports.parseLog = parseLog;
{'fraction_non_alphanumeric': 0.167835941716136, 'fraction_numerical': 0.004317323259579061, 'mean_word_length': 3.555282555282555, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4162392', 'n_tokens_mistral': 642, 'n_tokens_neox': 633, 'n_words': 122}