Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Set of methods to synchronize asynchronous operations.
npm install cjs-async
Run the tasks array of functions in parallel, without waiting until the previous function has completed. If any of the functions pass an error to its callback, the main callback is immediately called with the value of the error. Once the tasks have completed, the results are passed to the final callback as an array and hash. Task function name is used to name the corresponding hash-table values. Task function can either use callback to specify error and result value or return result value immediately.
Online example:
var parallel = require('cjs-async/parallel'),
taskList = [
function ( callback ) {
setTimeout(function () {
callback(null, true);
}, 10);
},
function ( callback ) {
setTimeout(function () {
callback(null, 256);
}, 20);
},
function ( callback ) {
setTimeout(function () {
callback(null, '512');
}, 0);
},
function () {
return 32;
}
];
parallel(taskList, function ( error, results ) {
if ( !error ) {
// results contains array of the given tasks execution results
// [true, 256, '512', 32]
console.log(results);
}
});
Run the functions in the tasks array in series, each one running once the previous function has completed. If any functions in the series pass an error to its callback, no more functions are run, and callback is immediately called with the value of the error. Otherwise, callback receives an array and hash of results when tasks have completed. Task function name is used to name the corresponding hash-table values. Task function can either use callback to specify error and result value or return result value immediately.
Online example:
var serial = require('cjs-async/serial'),
taskList = [
function () {
return 32;
},
function ( callback ) {
setTimeout(function () {
callback(null, true);
}, 10);
},
function ( callback ) {
setTimeout(function () {
callback(null, 256);
}, 20);
},
function ( callback ) {
setTimeout(function () {
callback(null, '512');
}, 0);
}
];
serial(taskList, function ( error, results ) {
if ( !error ) {
// results contains array of the given tasks execution results
// [32, true, 256, '512']
console.log(results);
}
});
If you have any problems or suggestions please open an issue according to the contribution rules.
cjs-async
is released under the MIT License.
FAQs
Asynchronous tools.
The npm package cjs-async receives a total of 335 weekly downloads. As such, cjs-async popularity was classified as not popular.
We found that cjs-async demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.