0.0.4 • Published 9 years ago

chaining-tool v0.0.4

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

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
    }
);