Skip to content

maxazan/chaining-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published