chaining-tool

0.0.4 • Public • Published

Chaining tool

Fast way to create chain of responsibility

##Install

npm install chaining-tool

##Usage

var Chain = require('chaining-tool');

var chain = new Chain();

chain.add(function(context, next){
    //Do somethong with context
    next(); //Next handler
});

chain.add(function(context, next){
    //Do somethong with context
    next(false); //Interrupt
});

var context = {"some" : "data"};

chain.start(context, 
    function(context) {
        //success
    }, 
    function(context) {
    //interrupted
    }
);

Readme

Keywords

none

Package Sidebar

Install

npm i chaining-tool

Weekly Downloads

1

Version

0.0.4

License

MIT

Last publish

Collaborators

  • maxazan