New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

mini-async

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

mini-async

Minimalist asynchronous javascript flow control

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

Mini-Async.js

Minimalist asynchronous javascript flow control in 34 lines. Inspired by async library.

Quick Examples

async.series([
  function(next, err, result) {
    return delay(function() {
      console.log(['a', next, err, result]);
      return next(err, 1);
    });
  }, function(next, err, result) {
    return delay(function() {
      console.log(['b', next, err, result]);
      return next(err, 2);
    });
  }, function(next, err, result) {
    return delay(function() {
      console.log(['c', next, err, result]);
      return next(err, 3);
    });
  }, function(next, err, result) {
    console.log(['d', next, err, result]);
    return next(err, 4);
  }
], function(next, err, result) {
  if (err) {
    return console.log(['series complete with error', next, err, result]);
  }
  return console.log(["series complete.", next, err, result]);
});

async.parallel([
  function(next) {
    return delay(function() {
      console.log(['e', next]);
      return next();
    });
  }, function(next) {
    return delay(function() {
      console.log(['f', next]);
      return next();
    });
  }, function(next) {
    console.log(['g', next]);
    return next();
  }
], function(err) {
  if (err) {
    return console.log(['parallel complete with error', err]);
  }
  return console.log(["parallel complete.", err]);
});

async.whilst((function() {
  console.log('my a');
  return count < 5;
}), (function(cb) {
  console.log('my b');
  count++;
  delay(cb);
}), (function(err) {
  console.log('my c');
}));

Keywords

miniature

FAQs

Package last updated on 03 Dec 2012

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