<commit_before>node-di-modules
===============

Simple helper to create module specification objects for node-di.
It gives you two methods to add modules to the container. The first one, .add(), is not more than
just setting modules[moduleName] = [type, module] manually. The reason why I built this is the second
method, .addDir(), which dynamically requires all \*.js files in the given folder and adds them to the
module container, using the file name as the module name and assuming type = 'factory'.


Installation
------------

`npm install di-modules`


Usage
-----

    var di = require('di');
    var modules = new require('di-modules')();

    modules.add('fs', 'value', require('fs'));
    modules.addDir('./src'); // contains myModule.js and yourModule.js, which must be "factory" modules

    new di.Injector([modules]).invoke(fs, myModule, yourModule) {
      ...
    });<commit_msg>Add recursive example to Usage section<commit_after>node-di-modules
===============

Simple helper to create module specification objects for node-di.
It gives you two methods to add modules to the container. The first one, .add(), is not more than
just setting modules[moduleName] = [type, module] manually. The reason why I built this is the second
method, .addDir(), which dynamically requires all \*.js files in the given folder and adds them to the
module container, using the file name as the module name and assuming type = 'factory'.


Installation
------------

`npm install di-modules`


Usage
-----

    var di = require('di');
    var modules = new require('di-modules')();

    modules.add('fs', 'value', require('fs'));
    modules.addDir('./src'); // contains myModule.js and yourModule.js, which must be "factory" modules
    modules.addDir('./src2', true); // recursively goes deeper into subdirectories

    // use di as if you filled the modules container manually
    new di.Injector([modules]).invoke(fs, myModule, yourModule) {
      ...
    });
{'fraction_non_alphanumeric': 0.1379837067209776, 'fraction_numerical': 0.0005091649694501018, 'mean_word_length': 3.548611111111111, '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': '1479353', 'n_tokens_mistral': 526, 'n_tokens_neox': 507, 'n_words': 230}