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.0 to 0.3.1

4

index.js

@@ -21,3 +21,3 @@ module.exports = series

if (tasks.length) {
tasks[current](done)
tasks[0](done)
} else {

@@ -44,3 +44,3 @@ cb(null, [])

if (tasks.length) {
tasks[current](done)
tasks[0](done)
} else {

@@ -47,0 +47,0 @@ cb(null, [])

{
"name": "run-series",
"description": "Run an array of functions in series",
"version": "0.3.0",
"version": "0.3.1",
"author": {

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

@@ -52,5 +52,44 @@ # 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/)

#### 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
function is not executed, and the main `callback` is immediately called with the error.
##### arguments
- `tasks` - An array of functions to run, each function is passed a
`callback(err, result1, result2, ...)` it must call on completion. The first argument is
an error (which can be `null`) and any further arguments will be passed as arguments in
order to the next task.
- `callback(err, [results])` - An optional callback to run once all the functions have
completed. This will be passed the results of the last task's callback.
##### example
```js
var series = require('run-series')
series.waterfall([
function (callback) {
callback(null, 'one', 'two')
},
function (arg1, arg2, callback) {
// arg1 now equals 'one' and arg2 now equals 'two'
callback(null, 'three')
},
function (arg1, callback) {
// arg1 now equals 'three'
callback(null, 'done', 'wohoo')
}
], function (err, result1, result2) {
// result1 now equals 'done'
// result2 now equals 'wohoo'
})
```
This module is basically equavalent to
[`async.series`](https://github.com/caolan/async#seriestasks-callback), but it's
handy to just have the one function you need instead of the kitchen sink. Modularity!
[`async.series`](https://github.com/caolan/async#seriestasks-callback) and
[`async.waterfall`](https://github.com/caolan/async#waterfalltasks-callback), but it's
handy to just have the functions you need instead of the kitchen sink. Modularity!
Especially handy if you're serving to the browser and need to reduce your javascript

@@ -57,0 +96,0 @@ bundle size.

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