<commit_before>#Why?
This is yet another try to solve callback hell and 500+ LOC files. Split your codebase into small easy-to-test and maintain modules and feed it to broom. It will run your code according
to each module dependencies. Broom will handle parallel and sequental execution of your modules where is needed.

#How can I install it?

`npm install broom`

#How can I use it?

assume we have directory structure like this:
  app
  -modules
   -first
    -index.js
   -second
    -index.js
   -third
    -index.js
*yourapp.js*
```javascript
  var Broom = require('broom').broom;
  var flow = new Broom({
    'fileName': 'index.js', //Broom will hunt for only for modules with this name, so you can put any files in brooms module directory.
    'dependenciesName': 'deps', //Broom will check this property for module dependencies
    'entryName': 'onStart' //What function Broom should run
  });
  flow.setRootPath(__dirname); //pointing to modules root directory
  flow.scan('./app/modules', function (err, done) { //path is relative to rootPath
    if (!done) {
      console.error('broom scan dirs completed with errors');
      console.dir(err);
      process.exit(1);
    }
  });

  //then set root arguments, you can reach them with {'main': '/'} in deps property of your modules
  flow.setRootArgs({'request': request, 'models': models});

  //run it
  flow.run(function (err, data) {
    //if any module pass error as first parameter to callback - flow will stop immideately and call final callback

    //you can reach results of your modules by path to index.js from Broom`s root
    data['/first'];
  });

```

###module example


*first/index.js*
```javascript

```

<commit_msg>improve readme, add some examples<commit_after>#Why?
This is yet another try to solve callback hell and 500+ LOC files. Split your codebase into small easy to test and maintain modules and feed it to broom. It will run your code according
to each module dependencies. Broom will handle parallel and sequental execution of your modules where it needed.

#How can I install it?

`npm install broom`

#How can I use it?

assume we have directory structure like this:
  app
  -modules
   -first
    -index.js
   -second
    -index.js
   -third
    -index.js
*yourapp.js*
```javascript
  var Broom = require('broom').broom;
  var flow = new Broom({
    'fileName': 'index.js', //Broom will hunt for only for modules with this name, so you can put any files in brooms module directory.
    'dependenciesName': 'deps', //Broom will check this property for module dependencies
    'entryName': 'onStart' //What function Broom should run
  });
  flow.setRootPath(__dirname); //pointing to modules root directory

  flow.scan('./app/modules', function (err, done) { //path is relative to rootPath
    if (!done) {
      console.error('broom scan dirs completed with errors');
      console.dir(err);
      process.exit(1);
    }
  });

  //then set root arguments, you can reach them with {'main': '/'} in deps property of your modules
  flow.setRootArgs({'request': request, 'models': models});

  //run it
  flow.run(function (err, data) {
    //if any module pass error as first parameter to callback - flow will stop immideately and call final callback

    //you can reach results of your modules by path to index.js from Broom`s root
    data['/first'];
  });

```

###module example


*first/index.js*
```javascript
var MyFirstModule = function () {
  this.deps = {
    'main': '/',
    'sec': '/second',
    'third': '/third'
  };
  this.onStart = this.entryPoint.bind(this);
};
MyFirstModule.prototype.entryPoint = function (callback, data) {
  //here you can access results of second/index.js with data.sec
  callback(null, {});
};
module.exports = MyFirstModule;
```
*second/index.js*
```javascript
var MySecondModule = function () {
  this.deps = {
    'main': '/'
  };
  this.onStart = this.entryPoint.bind(this);
};
MySecondModule.prototype.entryPoint = function (callback, data) {
  //here you can access root args with data.main
  callback(null, {});
};
module.exports = MySecondModule;
```

*third/index.js*
```javascript
var MyThirdModule = function () {
  this.deps = {
    'main': '/'
  };
  this.onStart = this.entryPoint.bind(this);
};
MyThirdModule.prototype.entryPoint = function (callback, data) {
  //here you can access root args with data.main
  callback(null, {});
};
module.exports = MyThirdModule;
```

Modules *second* and *third* will execute in parallel, and than *first* module will executed with results of *second* and *third* modules.



#Licence
MIT

{'fraction_non_alphanumeric': 0.11863666156871314, 'fraction_numerical': 0.0017478697837011142, 'mean_word_length': 3.466341463414634, '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': '36133', 'n_tokens_mistral': 1388, 'n_tokens_neox': 1352, 'n_words': 532}