Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hughsk/async-series
Standalone async.series() function
https://github.com/hughsk/async-series
Last synced: 12 days ago
JSON representation
Standalone async.series() function
- Host: GitHub
- URL: https://github.com/hughsk/async-series
- Owner: hughsk
- License: other
- Created: 2013-03-20T04:05:21.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-03-20T04:06:19.000Z (over 11 years ago)
- Last Synced: 2024-10-25T21:55:10.191Z (14 days ago)
- Language: JavaScript
- Size: 102 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# async-series #
Run a series of callbacks in sequence, as simply as possible.
More or less equivalent to
[async.series](https://github.com/caolan/async#series) - solely
for the sake of keeping some modules tiny for
[browserify](http://browserify.org/).## Installation ##
``` bash
npm install async-series
```## Usage ##
**series(tasks, callback, safe)**
Where `tasks` is an array of functions, each with their own `done`
argument. `callback` is called when finished. Setting `safe` to true
will ensure there's at least a tick between each task to prevent RangeErrors.``` javascript
series([
function(done) {
console.log('first thing')
done()
},
function(done) {
console.log('second thing')
done(new Error('another thing'))
},
function(done) {
// never happens, because "second thing"
// passed an error to the done() callback
}
], function(err) {
console.log(err.message) // "another thing"
})
```