New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-pipeline

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-pipeline

Simple module to performing asynchronous inter-dependent series operations in node. Unlike other more complicated approaches, this is pure javascript and very small (~100 lines of code with comments).

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

pipeline

Node.js module for simplifying and sequencing a number of dependent functions and callbacks.

Simple module to performing asynchronous inter-dependent series operations in node. Unlike other more complicated approaches, this is pure javascript and very small (~100 lines of code with comments).

Install

npm install node-pipeline

Simple example for calculating gratuity

This example is in the tests folder. It is basic and does not fully test all error conditions, but it is a good way to get the hang of the module.

var pipeline = require('node-pipeline'),
	pl = pipeline.create("Tax and Gratuity Calculator");

pl.on('end', function(err, results) {
	if (err) {
		console.log('Error in pipeline: ' + err);
	}

	console.log("Raw results" + JSON.stringify(results, 2) );
	process.exit();
});


pl.use(function(results, next) {
	var price = Number(results[0].price),
		taxrate = Number(results[0].taxrate);

	next(null, { tax : price * taxrate });
});


pl.use(function(results, next) {
	var price = Number(results[0].price),
		tax = Number(results[1].tax),
		gratuityrate = Number(results[0].gratuityrate);

	next(null, { gratuity : (price + tax) * gratuityrate }) 
});


pl.execute({
	currency: "USD",
	symbol: "$",
	price: argv.price || 0,
	taxrate: argv.tax || 0.0825,
	gratuityrate: argv.gratuity || "0.25"
});

Keywords

FAQs

Package last updated on 10 Oct 2013

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