Socket
Socket
Sign inDemoInstall

achain.js

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    achain.js

A simple module to chain asynchronous calls.


Version published
Maintainers
1
Created

Readme

Source

achain.js

Build Status

A simple module to chain asynchronous calls. Please look at the code or the test code for more examples.

Usage


var Chain = require("achain.js");

var args_list = [ 1, 2, 3, 4, 5, 6, 7 ];
var chain = new Chain();

function inc(args, options, callback)
{
  options.value++;
  options.args_list = options.args_list || [];
  options.args_list.push(args);
  callback();
};

chain.addMany(args_list, inc);
chain.add(8, inc);

chain.final(function(error, options)
{
  if (error)
  {
    console.log(error);
    return;
  }

  console.log(options.value); // 8
  console.log(options.args_list); // [ 1, 2, 3, 4, 5, 6, 7, 8 ];
});

chain.run();

FAQs

Last updated on 12 Jun 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc