<commit_before>onmessage = function(e){
  var start = Date.now();
  var text = e.data;
  if(!text || text.length == 0) return [];
  var seqs = [], currentSeq = {};
  var lines = text.split(/[\r\n]+/g);
  var n = lines.length;
  var isblank = /^\s*$/;
  for(var i = 0; i < n; i++){
    var line = lines[i];
    if(isblank.test(line) || line[0] == ';') continue;
    if(line[0] == '>'){
      if(i > 0) seqs.push(currentSeq);
      currentSeq = {
        id: line.slice(1),
        seq: ''
      };
    } else {
      currentSeq.seq += line.toUpperCase();
    }
  }
  seqs.push(currentSeq);
  console.log('FASTA Parse time: ', (Date.now()-start).toLocaleString(), 'ms');
  start = Date.now();
  var encoder = new TextEncoder();
  var output = encoder.encode(JSON.stringify(seqs)).buffer;
  postMessage({nodes: output, start: start}, [output]);
  close();
};
<commit_msg>fix: #190 hidden char issue<commit_after>onmessage = function(e){
  var start = Date.now();
  var text = e.data;
  if(!text || text.length == 0) return [];
  var seqs = [], currentSeq = {};
  var lines = text.split(/[\r\n]+/g);
  var n = lines.length;
  var isblank = /^\s*$/;
  for(var i = 0; i < n; i++){
    var line = lines[i].trim();  // issue 189, 190
    if(isblank.test(line) || line[0] == ';') continue;
    if(line[0] == '>'){
      if(i > 0) seqs.push(currentSeq);
      currentSeq = {
        id: line.slice(1),
        seq: ''
      };
    } else {
      currentSeq.seq += line.toUpperCase();
    }
  }
  seqs.push(currentSeq);
  console.log('FASTA Parse time: ', (Date.now()-start).toLocaleString(), 'ms');
  start = Date.now();
  var encoder = new TextEncoder();
  var output = encoder.encode(JSON.stringify(seqs)).buffer;
  postMessage({nodes: output, start: start}, [output]);
  close();
};

{'fraction_non_alphanumeric': 0.21058558558558557, 'fraction_numerical': 0.011824324324324325, 'mean_word_length': 2.888402625820569, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4589497', 'n_tokens_mistral': 665, 'n_tokens_neox': 640, 'n_words': 143}