https://github.com/developit/praline
Parallel task wrapper for Node-style callbacks
https://github.com/developit/praline
Last synced: 9 months ago
JSON representation
Parallel task wrapper for Node-style callbacks
- Host: GitHub
- URL: https://github.com/developit/praline
- Owner: developit
- License: mit
- Created: 2015-05-29T00:21:03.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-05-14T02:49:42.000Z (over 8 years ago)
- Last Synced: 2025-04-10T11:16:09.793Z (9 months ago)
- Language: JavaScript
- Homepage: http://npm.im/praline
- Size: 24.4 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
praline [![NPM][npm-version-image]][npm-url] [![Bower][bower-image]][bower-url] [![Downloads][npm-downloads-image]][npm-url] [![Build Status][travis-image]][travis-url]
=======
> Parallel task wrapper for Node-style callbacks
Tasks are functions, or arrays where the first item is a function and the remainder are arguments to pass it.
All tasks must have Node-style callbacks like `(err, result)`.
---
# `parallel()`
Execute an Array of tasks in parallel.
> `tasks` - Array of tasks to run in parallel
>
> `callback` - Gets called on completion `(err, ...results)`
```js
parallel([
taskOne,
[taskTwo, 'arg1', 'arg2'],
cb => cb(null, 'data3')
], (err, t1Result, t2Result, data3) => {
callback(err, { t1Result, t2Result, data3 });
});
```
# `sequence()`
Execute an Array of tasks in order.
> `tasks` - Array of tasks to run in order
>
> `callback` - Gets called on completion `(err, ...results)`
```js
sequence([
taskOne,
[taskTwo, 'arg1', 'arg2']
], (err, t1, t2) => {
callback(err, { t1, t2 });
});
```
---
License
-------
MIT
[npm-url]: https://npmjs.org/package/praline
[bower-url]: http://bower.io/search/?q=praline
[travis-url]: http://travis-ci.org/developit/praline
[npm-version-image]: http://img.shields.io/npm/v/praline.svg?style=flat-square
[npm-downloads-image]: http://img.shields.io/npm/dm/praline.svg?style=flat-square
[bower-image]: https://img.shields.io/bower/v/praline.svg?style=flat-square
[travis-image]: http://img.shields.io/travis/developit/praline.svg?style=flat-square