<commit_before>const convertAttributes = (obj) => {
  var xml = ''
  if (obj.$) {
    for (var attrKey in obj.$) {
      xml += ` ${attrKey}="${obj.$[attrKey]}"`
    }
  }

  return xml
}

const convertBody = (obj) => {
  if (obj == null) {
    return ''
  }

  if (typeof obj === 'string') {
    return obj.toString()
  }

  var xml = ''
  for (var key in obj) {
    if (obj[key] == null || key === '$') {
      continue
    }

    if (Array.isArray(obj[key])) {
      for (var i = 0; i < obj[key].length; i++) {
        if (Object.keys(obj[key][i]).length > 1 || Object.keys(obj[key][i])[0] !== '$') {
          var body = convertBody(obj[key][i])
          xml += '<' + key + convertAttributes(obj[key][i])
          xml += body ? (`>\n${body}\n</${key}>\n`) : '/>\n'
        } else {
          xml += `<${key}${convertAttributes(obj[key][i])}/>\n`
        }
      }

      continue
    }

    if (key === '_') {
      return obj[key].toString()
    }

    xml += '<' + key

    xml += convertAttributes(obj[key])
    var body = convertBody(obj[key])
    xml += body ? (`>\n${body}\n</${key}>\n`) : '/>\n'
  }

  return xml
}

module.exports = (o) => ('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n' + convertBody(o))<commit_msg>remove line breaks to fix excel<commit_after>import os from 'os'

const convertAttributes = (obj) => {
  var xml = ''
  if (obj.$) {
    for (var attrKey in obj.$) {
      xml += ` ${attrKey}="${obj.$[attrKey]}"`
    }
  }

  return xml
}

const convertBody = (obj) => {
  if (obj == null) {
    return ''
  }

  if (typeof obj === 'string') {
    return obj.toString()
  }

  var xml = ''
  for (var key in obj) {
    if (obj[key] == null || key === '$') {
      continue
    }

    if (Array.isArray(obj[key])) {
      for (var i = 0; i < obj[key].length; i++) {
        if (Object.keys(obj[key][i]).length > 1 || Object.keys(obj[key][i])[0] !== '$') {
          var body = convertBody(obj[key][i])
          xml += '<' + key + convertAttributes(obj[key][i])
          xml += body ? (`>${body}</${key}>\n`) : '/>'
        } else {
          xml += `<${key}${convertAttributes(obj[key][i])}/>`
        }
      }

      continue
    }

    if (key === '_') {
      return obj[key].toString()
    }

    xml += '<' + key

    xml += convertAttributes(obj[key])
    var body = convertBody(obj[key])
    xml += body ? (`>${body}</${key}>`) : '/>'
  }

  return xml
}

module.exports = (o) => ('<?xml version="1.0" encoding="UTF-8"?>\n' + convertBody(o))
{'fraction_non_alphanumeric': 0.23536487570168405, 'fraction_numerical': 0.0048115477145148355, 'mean_word_length': 2.2657068062827226, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 2, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 24}, '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': '5348719', 'n_tokens_mistral': 926, 'n_tokens_neox': 899, 'n_words': 189}