
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
=========
like q/async
test case will coming soon... more function will coming soon...
用于实现异步的流程同步执行
Check out [https://github.com/microlv/FlatQ.git]
for details over the differences between builds.
GitHub: https://github.com/microlv/FlatQ/ Wiki: http://microlv.github.io/FlatQ
like q/async, but the code is simple and powerful and useful.
every function will inject a argument name 'defer', you can use it to resolve/reject. or detect the defer.err to see parent function has error or not.
Chrome, Nodejs
npm install flatq --save
sample use:
$q(function (d) {
setTimeout(function () {
console.log('function 1');
d.resolve('pass data to next function!');
console.log('function 1 step 2');
}, 0);
console.log('function 1 step 1');
}).then(function (d, data) {
console.log('function 2');
console.log(data);
d.reject();
}).then(function () {
console.log('function 3,function2 resolve will go here');
}, function () {
console.log('function 3 function2 reject will go here');
}).then(function () {
console.log('function 4');
});
series:
$q.series([function(d){
use resolve will make the series execute next task!
d.resolve();
//step pass data
var passData={hello:'world'};
d.resolve(passData)
reject will make series stop.
d.reject();
}],function(d,data){
I can get the data from //step pass data
console.log(data);
});
series example:
$q.series([
function (d) {
console.log('series 1');
setTimeout(function () {
d.resolve('series 2 finish!');
}, 0);
},
function (d) {
console.log('series 2');
setTimeout(function () {
d.resolve('series 2 finish!');
}, 0);
},
function (d) {
console.log('series 3');
setTimeout(function () {
d.resolve('series 3 finish!');
}, 0);
}
], function (d,result) {
console.log('finish');
d.resolve();
}).then(function (d) {
console.log('then start');
});
Andy.lv@live.com; Any problem contact with me.
FAQs
async for promise
We found that flatq 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.