<commit_before>// Originally Copyright (C) 2013 eBay Software Foundation
// That was taken from Kraken and modified to suit my needs

var fs = require('fs');
var path = require('path');
var assert = require('assert');
var Promise = require('bluebird');


function loaddir(directory) {
    return scan(resolve(directory));
}

function scan(file, controllers) {
    var stats;

    controllers = controllers || [];
    if (typeof file !== 'string') {
        return controllers;
    }

    assert.ok(fs.existsSync(file), 'Service directory not found. (\'' + file + '\')');

    stats = fs.statSync(file);
    if (stats.isDirectory())  {
        fs.readdirSync(file).forEach(function (child) {
            scan(path.join(file, child), controllers);
        });
    } else if (stats.isFile() && file.match(/\.(js|coffee)$/i)) {
        controllers.push(file);
    }

    return controllers;
}

function resolve(file) {
    if (!file) {
        return undefined;
    }

    if (Array.isArray(file)) {
        file = path.join.apply(undefined, file);
    }

    file = path.resolve(file);
    return file;
}

function dirject(container, receiver, directory) {
	var promises = [];
  loaddir(settings.directory).forEach(function (file) {
      var service = require(file);
      if (typeof service === 'function') {
          promises.push(container.inject(service, receiver));
      }
  });

  return Promise.all(promises);
}


module.exports = dirject;<commit_msg>Fix typo<commit_after>// Originally Copyright (C) 2013 eBay Software Foundation
// That was taken from Kraken and modified to suit my needs

var fs = require('fs');
var path = require('path');
var assert = require('assert');
var Promise = require('bluebird');


function loaddir(directory) {
    return scan(resolve(directory));
}

function scan(file, controllers) {
    var stats;

    controllers = controllers || [];
    if (typeof file !== 'string') {
        return controllers;
    }

    assert.ok(fs.existsSync(file), 'Service directory not found. (\'' + file + '\')');

    stats = fs.statSync(file);
    if (stats.isDirectory())  {
        fs.readdirSync(file).forEach(function (child) {
            scan(path.join(file, child), controllers);
        });
    } else if (stats.isFile() && file.match(/\.(js|coffee)$/i)) {
        controllers.push(file);
    }

    return controllers;
}

function resolve(file) {
    if (!file) {
        return undefined;
    }

    if (Array.isArray(file)) {
        file = path.join.apply(undefined, file);
    }

    file = path.resolve(file);
    return file;
}

function dirject(container, receiver, directory) {
	var promises = [];
  loaddir(directory).forEach(function (file) {
      var service = require(file);
      if (typeof service === 'function') {
          promises.push(container.inject(service, receiver));
      }
  });

  return Promise.all(promises);
}


module.exports = dirject;
{'fraction_non_alphanumeric': 0.1512749827705031, 'fraction_numerical': 0.0027567195037904893, 'mean_word_length': 3.0152143845089903, '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': '7170318', 'n_tokens_mistral': 889, 'n_tokens_neox': 847, 'n_words': 212}