
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.
`flatAsync` a simple wrapper to use Async/Await call without try/catch blocks.
flatAsync a simple wrapper to use Async/Await calls without try/catch blocks.
Flat style pattern to handle errors.
npm i flatasync --save
import flatAsync from 'flatasync'
const flatAsync = require('flatasync');
import flatAsync from 'flatasync';
const [err, response] = await flatAsync(AsyncCall(...));
if (err) return console.error(err);
if (!response) return console.console('Not Found');
// use response here
You must use try/catch in Javascript's await calls to handle errors from promise.
try {
const user = await ajaxAPICall('/users/1');
if(!user) return cb(null, 'User not found');
} catch(e) {
return cb(e, 'Unexpected error occurred');
}
// another call based on user's data
try {
const post = await ajaxAPICall(`/posts/${user.postId}`);
if(!post) return cb(null, 'Post not found for user ${user.name}');
else return return cb(null, post);
} catch(e) {
return cb(e, 'Unexpected error occurred');
}
flatAsync wraps your await Promise or Method and returns errors/results in array [err, results].
import flatAsync from 'flatasync';
...
let user, post, err;
[err, user] = await flatAsync(AjaxCall('/user/1'));
if(err || !user) return cb(err, 'User not found');
[err, post] = await flatAsync(AjaxCall(`/posts/${user.postId}`));
if(err || !post) return cb(err, 'Post not found');
return cb(null, post);
FAQs
`flatAsync` a simple wrapper to use Async/Await call without try/catch blocks.
The npm package flatasync receives a total of 1 weekly downloads. As such, flatasync popularity was classified as not popular.
We found that flatasync 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.