Socket
Socket
Sign inDemoInstall

run-series

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

run-series - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

waterfall.js

25

index.js
module.exports = series
module.exports.waterfall = waterfall
module.exports.waterfall = require('./waterfall')

@@ -26,24 +26,1 @@ function series (tasks, cb) {

}
function waterfall (tasks, cb) {
var current = 0
cb = cb || function () {}
function done (err) {
var args = Array.prototype.slice.call(arguments, 1)
if (err) return cb(err, args)
if (++current >= tasks.length) {
cb.apply(undefined, [null].concat(args))
} else {
tasks[current].apply(undefined, args.concat(done))
}
}
if (tasks.length) {
tasks[0](done)
} else {
cb(null, [])
}
}
{
"name": "run-series",
"description": "Run an array of functions in series",
"version": "0.3.1",
"version": "0.4.0",
"author": {

@@ -6,0 +6,0 @@ "name": "Feross Aboukhadijeh",

@@ -1,2 +0,2 @@

# run-series [![travis](https://img.shields.io/travis/feross/run-series.svg)](https://travis-ci.org/feross/run-series) [![npm](https://img.shields.io/npm/v/run-series.svg)](https://npmjs.org/package/run-series) [![gittip](https://img.shields.io/gittip/feross.svg)](https://www.gittip.com/feross/)
# run-series [![travis](https://img.shields.io/travis/feross/run-series.svg)](https://travis-ci.org/feross/run-series) [![npm](https://img.shields.io/npm/v/run-series.svg)](https://npmjs.org/package/run-series)

@@ -52,6 +52,6 @@ ### Run an array of functions in series

#### waterfall(tasks, [callback])
#### series.waterfall(tasks, [callback])
Runs the `tasks` array of functions in series, each passing their results to the next in
the array. However, if any of the `tasks` pass an error to their own callback, the next
Runs the `tasks` array of functions in series, **each passing their results to the next in
the array**. However, if any of the `tasks` pass an error to their own callback, the next
function is not executed, and the main `callback` is immediately called with the error.

@@ -58,0 +58,0 @@

var series = require('../')
var waterfall = require('../waterfall')
var test = require('tape')
test('require(run-series/waterfall) usage', function (t) {
t.equal(waterfall, series.waterfall)
t.end()
})
test('waterfall: functions pass results to next function', function (t) {

@@ -5,0 +11,0 @@ t.plan(8)

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