🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

pipex

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pipex

simple function pipelining module that simplify the callback in nodejs

latest
Source
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

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.

  • support multiple arguments for resolve / reject function
  • 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();

Keywords

promise

FAQs

Package last updated on 09 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts