Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pfrazee/multicb
Simple way to aggregate multiple node-style callbacks
https://github.com/pfrazee/multicb
Last synced: 2 months ago
JSON representation
Simple way to aggregate multiple node-style callbacks
- Host: GitHub
- URL: https://github.com/pfrazee/multicb
- Owner: pfrazee
- License: mit
- Created: 2014-09-17T15:26:10.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-07-09T16:08:50.000Z (over 6 years ago)
- Last Synced: 2024-10-17T17:37:08.654Z (2 months ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 19
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MultiCB
Simple way to aggregate multiple node-style callbacks
```js
var multicb = require('multicb')// default usage
var done = multicb()
doAsync(done())
doAsync(done())
doAsync(done())
done(function(err, results) {
console.log(err) // => undefined
console.log(results) /* =>
[
[undefined, 'foo'],
[undefined, 'bar'],
[undefined, 'baz']
]
*/
})// pluck argument
var done = multicb({ pluck: 1 })
doAsync(done())
doAsync(done())
doAsync(done())
done(function(err, results) {
console.log(err) // => undefined
console.log(results) /* =>
[
'foo',
'bar',
'baz'
]
*/
})// spread argument
var done = multicb({ pluck: 1, spread: true })
doAsync(done())
doAsync(done())
doAsync(done())
done(function(err, a, b, c) {
console.log(err) // => undefined
console.log(a) // => 'foo'
console.log(b) // => 'bar'
console.log(c) // => 'baz'
})
```