<commit_before>module.exports = function nodeToObject(node, r_) {
  var r = r_ || {}
  var split = node.key.split('/').filter(Boolean)
  var key = split[split.length - 1]

  if (node.dir) {
    r[key] = {}
    node.nodes.forEach(function(childNode) { nodeToObject(childNode, r[key]) })
  }
  else {
    r[key] = node.value
  }

  return r
}<commit_msg>`etcd` doesn't add `.key` to its root directory node<commit_after>module.exports = function nodeToObject(node, r_) {
  var r = r_ || {}
  var split = (node.key || '/').split('/').filter(Boolean)
  var key = split[split.length - 1]

  if (node.dir) {
    r[key] = {}
    node.nodes.forEach(function(childNode) { nodeToObject(childNode, r[key]) })
  }
  else {
    r[key] = node.value
  }

  return r
}
{'fraction_non_alphanumeric': 0.1768617021276596, 'fraction_numerical': 0.0026595744680851063, 'mean_word_length': 3.206703910614525, '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': '6007476', 'n_tokens_mistral': 284, 'n_tokens_neox': 274, 'n_words': 59}