0.0.6 • Published 8 years ago

pipex v0.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

pipex

About

pipex (piped executor) is simple but powerful function chaining module inspired by promise, so it has similar figure to promise, however, it provides more flexibility for callback function. and I believe it will bring us more leaner implementaion and great managability as well eventually.

  1. support multiple arguments for resolve / reject function
  2. consistant (resolve, reject) interface independent from the where the callback located.

Install

npm install pipex --save

How to use

var pipex = require('pipex');

pipex(function start(ctx){
    console.log('start here and if successful call \'resolve\'');
    ctx.resolve('hello');
}).then(function (ctx, val){
    console.log(val);
    console.log('this will print hello');
    ctx.resolve(val + ' world');
}).then(function (ctx, val) {
    console.log(val);
    console.log('this will print hello world apparently');
    ctx.resolve(val, val + ' againe');
}).then(function (ctx, val0, val1) {
    console.log(val1);
    console.log('this will print hello world again');
    ctx.reject('hello');
}).then(function (ctx, val){
    console.log('this will skipped');
}).catch(function (ctx, val){
    console.log(val);
    console.log('this will print hello');
}).execute();
0.0.6

8 years ago

0.0.5-rc

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago