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.
breeze-async
Advanced tools
Simple series and parallel flow control.
breeze-async
is available on npm.
$ npm install breeze-async
breeze-async
is available as a component.
$ component install qualiancy/breeze-async
Once you require breeze-async
, the following API will be available.
var async = require('breeze-async');
Apply an iterator to each item in an array in parellel. Execute a callback when all items have been completed or immediately if there is an error provided.
async.forEach([ 1, 2, 3 ], function (i, next) {
setTimeout(function () {
console.log(i);
next();
}, 10);
}, function (err) {
should.not.exist(err);
console.log('all done');
});
Apply an iterator to each item in an array serially. Execute a callback when all items have been completed or immediately if there is is an error provided.
async.forEachSeries([ 1, 2, 3 ], function (i, next) {
setTimeout(function () {
console.log(i);
next();
}, 10);
}, function (err) {
should.not.exist(err);
console.log('all done');
});
Execute a collection of functions in parellel and execute a callback upon completion or occurance of an error. Functions can be provided as either an array or an object. Each function will be passed a callback to signal completion. The callback accepts either an error for the first argument, or null for the first argument and results following. The results will be provied as the second argument of the callback in-kind, maintaining the order of the input array or the keys of the input object.
async.parallel([
function (next) {
setTimeout(function () {
next(null, 'one');
}, 15);
}
, function (next) {
setTimeout(function () {
next(null, 'two');
}, 10);
}
, function (next) {
setTimseout(function () {
next(null, 'three');
}, 5);
}s
], function (err, res) {
should.not.exist(err);
res.should.deep.equal([ 'one', 'two', 'three' ]);
});
async.parallel({
one: function (next) {
setTimeout(function () {
next(null, 'one');
}, 15);
}
, two: function (next) {
setTimeout(function () {
next(null, 'two');
}, 10);
}
, three: function (next) {
setTimeout(function () {
next(null, 'three');
}, 5);
}
}, function (err, res) {
should.not.exist(err);
res.should.deep.equal({
one: 'one'
, two: 'two'
, three: 'three'
});
});
Execute a collection of functions serially and execute a callback upon completion or occurance of an error. Functions can be provided as either an array or an object. Each function will be passed a callback to signal completion. The callback accepts either an error for the first argument, or null for the first argument and results following. The results will be provied as the second argument of the callback in-kind, maintaining the order of the input array or the keys of the input object.
async.series([
function (next) {
setTimeout(function () {
next(null, 'one');
}, 15);
}
, function (next) {
setTimeout(function () {
next(null, 'two');
}, 10);
}
, function (next) {
setTimseout(function () {
next(null, 'three');
}, 5);
}s
], function (err, res) {
should.not.exist(err);
res.should.deep.equal([ 'one', 'two', 'three' ]);
});
async.series({
one: function (next) {
setTimeout(function () {
next(null, 'one');
}, 15);
}
, two: function (next) {
setTimeout(function () {
next(null, 'two');
}, 10);
}
, three: function (next) {
setTimeout(function () {
next(null, 'three');
}, 5);
}
}, function (err, res) {
should.not.exist(err);
res.should.deep.equal({
one: 'one'
, two: 'two'
, three: 'three'
});
});
(The MIT License)
Copyright (c) 2012 Jake Luer jake@qualiancy.com (http://qualiancy.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Simple series and parallel flow control.
The npm package breeze-async receives a total of 84 weekly downloads. As such, breeze-async popularity was classified as not popular.
We found that breeze-async demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.