Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Feb 20, 2024 via pnpm

run-async 2.4.1

Utility method to run function either synchronously or asynchronously using the common `this.async()` style.
Package summary
Share
0
issues
1
license
1
MIT
Package created
11 Aug 2014
Version published
27 Apr 2020
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
run-async@2.4.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of run-async 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does run-async do?

Run-async is a versatile utility in JavaScript programming providing the ability to execute functions either synchronously or asynchronously. It normaIn JavaScript, synchronous execution means that the functions will run sequentially from top to bottom in a predicable manner while async execution means functions can run concurrently without waiting for the previous function to complete. There's also a normalization of multiple function signatures supported. It's particularly useful when writing libraries and dealing with both sync and async functions as inputs.

How do you use run-async?

To use run-async, first, you need to install it via npm with the command npm install --save run-async. Then, require it in your JavaScript file with var runAsync = require('run-async');. With run-async set up, there are various ways and methods to initiate the function:

  • Using this.async method, which allows for callback function. Here's an example code:
printAfter(function () {
 var done = this.async();
 setTimeout(function () {
   done(null, 'done running with callback');
 }, 10);
});
  • Running a function that returns a Promise.
printAfter(function () {
 return new Promise(function (resolve, reject) {
   resolve('done running with promises');
 });
});
  • Executing a synchronous function.
printAfter(function () {
 return 'done running sync function';
});
  • Using runAsync.cb, which invokes the traditional callback format with a callback as the last argument.
var runAsync = require('run-async');

// NOTE: The wrapped function must have a fixed number of parameters.
runAsync.cb(function(a, b, cb) {
 cb(null, a + b);
}, function(err, result) {
 console.log(result)
})(1, 2)

Other features of run-async like custom done factory and passing context to an async method can also be deployed as you customize it to your needs.

Where are the run-async docs?

The documentation for run-async can be found in its readme file on its GitHub repository page. Here's the GitHub URL: https://github.com/SBoudrias/run-async. For a thorough understanding of its usage and potential, please visit and examine the details, code snippets, and guidelines provided on the readme.