<commit_before>var fs = require('fs'),
    path = require('path'),
    util = require('util');

var JSLoader = function(srcDirs) {
    if (srcDirs.length == 0) {
        throw new Error('no source directories provided');
    }
    this.srcDirs = srcDirs;
};

JSLoader.prototype.getContent = function(files, callback) {
    if (typeof(files) === 'undefined' || files.length == 0) {
        callback(null, '');
        return;
    }
    this.loadContent(files, function(err, content) {
        callback(null, content);
    });
};

JSLoader.prototype.getContent = function(files, callback) {
    var self = this;
    if (files.length == 0) {
        callback(null, '');
        return;
    }
    this.readFilesWithDependencies(files, function(err, fileDataList, fileDataMap) {
        var content = self.getFileContentInOrderByDependencies(fileDataList, fileDataMap);
        callback(null, content);
    });
};

JSLoader.prototype.readFilesWithDependencies = function(files, callback) {
    var self = this,
        fileDataList = [], //need to guarantee order
        fileDataMap = {}; //also need fast lookup, so we will use these side-by-side
<commit_msg>Remove old, duplicate function.<commit_after>var fs = require('fs'),
    path = require('path'),
    util = require('util');

var JSLoader = function(srcDirs) {
    if (srcDirs.length == 0) {
        throw new Error('no source directories provided');
    }
    this.srcDirs = srcDirs;
};

JSLoader.prototype.getContent = function(files, callback) {
    var self = this;
    if (files.length == 0) {
        callback(null, '');
        return;
    }
    this.readFilesWithDependencies(files, function(err, fileDataList, fileDataMap) {
        var content = self.getFileContentInOrderByDependencies(fileDataList, fileDataMap);
        callback(null, content);
    });
};

JSLoader.prototype.readFilesWithDependencies = function(files, callback) {
    var self = this,
        fileDataList = [], //need to guarantee order
        fileDataMap = {}; //also need fast lookup, so we will use these side-by-side

{'fraction_non_alphanumeric': 0.13203883495145632, 'fraction_numerical': 0.0024271844660194173, 'mean_word_length': 3.155241935483871, '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': '4570393', 'n_tokens_mistral': 613, 'n_tokens_neox': 613, 'n_words': 146}