<commit_before>'use strict';


/* Utility functions */

// Recursively walk an AST node searching for content leaves
function walkContent(node, fn) {
  if (typeof node === 'string') {
    return fn(node);
  }

  var rv = {};
  for (var key in node) {
    if (key === '_index') {
      rv[key] = node[key];
    } else {
      rv[key] = walkContent(node[key], fn);
    }
  }
  return rv;
}<commit_msg>Bug 1073338 - Use Object.keys in walkContent. r=gandalf<commit_after>'use strict';


/* Utility functions */

// Recursively walk an AST node searching for content leaves
function walkContent(node, fn) {
  if (typeof node === 'string') {
    return fn(node);
  }

  var rv = {};
  var keys = Object.keys(node);

  /* jshint boss:true */
  for (var i = 0, key; key = keys[i]; i++) {
    if (key === '_index') {
      rv[key] = node[key];
    } else {
      rv[key] = walkContent(node[key], fn);
    }
  }
  return rv;
}
{'fraction_non_alphanumeric': 0.16466739367502725, 'fraction_numerical': 0.008724100327153763, 'mean_word_length': 2.762295081967213, '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': '3693047', 'n_tokens_mistral': 331, 'n_tokens_neox': 313, 'n_words': 94}