Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

after-all

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

after-all - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

6

index.js

@@ -1,2 +0,4 @@

var util = require('util');
var isError = function(e) {
return Object.prototype.toString.call(e) === '[object Error]' || e instanceof Error;
};

@@ -25,3 +27,3 @@ module.exports = function(afterAllCb) {

if (done) return;
if (util.isError(err)) {
if (isError(err)) {
done = true;

@@ -28,0 +30,0 @@ return afterAllCb(err);

{
"name": "after-all",
"version": "1.0.0",
"version": "1.1.0",
"description": "Execute several async functions and get a callback when they are all done",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -57,5 +57,10 @@ # after-all

db.findProducts(next(function(err, docs) {
resp.products = docs;
}));
var cb = next(); // wrapping the callback is optional
db.findProducts(function(err, docs) {
db.findProductsSales(function(sales) {
resp.products = docs;
resp.productsSales = sales;
cb();
});
});

@@ -72,2 +77,8 @@ db.findTodaySalesAmount(next(function(err, amount) {

As you can see, passing a callback to the `next` function is optional and it can be
useful to not pass any when you are doing more than one sequetial async operations as
in the example above.
Also notice that all the calls to `next` must be done on the same tick.
## Error handling

@@ -74,0 +85,0 @@

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