Socket
Socket
Sign inDemoInstall

callback-all

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

callback-all

Aggregate multiple callbacks.


Version published
Maintainers
1
Created
Source

callback-all

Aggregate all callback sequence into one array result.

Build Status

npm install callback-all
var callbacks = require('callback-all')

var all = callbacks()

asyncFn1(all()) // foo
asyncFn2(all()) // bar
asyncFn3(all()) // hello
asyncFn4(all()) // world

all(function (err, result) {
  // return err if any of them error
  // result array followed by all() sequence
  console.log(result) // ['foo', 'bar', 'hello', 'world']
})

yield parallel callbacks in caco:

var caco = require('caco')
var callbacks = require('callback-all')


caco(function * (next) {
  asyncFn1(all()) // foo
  asyncFn2(all()) // bar
  asyncFn3(all()) // hello
  asyncFn4(all()) // world

  var result = yield all(next)

  console.log(result) // ['foo', 'bar', 'hello', 'world']

})(function (err) {
 // handle thrown error
})

FAQs

Package last updated on 15 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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