Socket
Socket
Sign inDemoInstall

promise-pipeline

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promise-pipeline

nodejs pipeline


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

promise pipeline

Node.js module for execute a sequencing a number of dependent functions and return a promise when the operation is done

Install

npm install promise-pipeline

How to use it

This is the generic way to initialize a Pipeline object

var Pipeline = require('promise-pipeline')

var pipeline = new Pipeline()
    .use(func1)
    .use(func2)
    .use(function(input, output, next) {
        console.log(output)
        next()
    })

var input = {
    data: 'some initial value'
}

var output = {}

pipeline.start(input, output)
    .then(o => {
        //Do something whit the final output
    })

Pipeline functions

Each function of the pipeline receives 3 parameters: input, output, next

function func1(input, output, next){
    output.data = input.data
    //Do something great here, then call the next function
    next()
}

function func2(input, output, next){
    db.insert(output).then(o => {
        next()
    })
}

Keywords

FAQs

Package last updated on 08 Jan 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc