<commit_before>var fs = require('fs');

module.exports = {
  walk: function(dir, done) {
    var self = this;
    var results = [];
    fs.readdir(dir, function(err, list) {
      if (err) return done(err);
      var pending = list.length;
      if (!pending) return done(null, results);
      list.forEach(function(file) {
        file = dir + '/' + file;
        fs.stat(file, function(err, stat) {
          if (stat && stat.isDirectory()) {
            self.walk(file, function(err, res) {
              results = results.concat(res);
              if (!--pending) done(null, results);
            });
          } else {
            results.push(file);
            if (!--pending) done(null, results);
          }
        });
      });
    });
  },
  strRepeat: function(str, length){
    var out = '';
    for( var x=0; x<length; x++){
      out += str;
    }
    return out;
  }
}<commit_msg>0.0.4 Added concatArray helper function<commit_after>var fs = require('fs');

module.exports = {
  walk: function(dir, done) {
    var self = this;
    var results = [];
    fs.readdir(dir, function(err, list) {
      if (err) return done(err);
      var pending = list.length;
      if (!pending) return done(null, results);
      list.forEach(function(file) {
        file = dir + '/' + file;
        fs.stat(file, function(err, stat) {
          if (stat && stat.isDirectory()) {
            self.walk(file, function(err, res) {
              results = results.concat(res);
              if (!--pending) done(null, results);
            });
          } else {
            results.push(file);
            if (!--pending) done(null, results);
          }
        });
      });
    });
  },
  strRepeat: function(str, length){
    var out = '';
    for( var x=0; x<length; x++){
      out += str;
    }
    return out;
  },
  concatArray: function (arrays) { // res == array of array
    for(var a in arrays) {
      if (a == 0) {
        var arr = arrays[a];
      } else {
        arr = arr.concat(arrays[a])
      }
    }
    return arr;
  }
}
{'fraction_non_alphanumeric': 0.16193737769080235, 'fraction_numerical': 0.0029354207436399216, 'mean_word_length': 1.7899045020463846, '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': '6384784', 'n_tokens_mistral': 647, 'n_tokens_neox': 640, 'n_words': 158}