
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.
smears (or spreads) a single array parameter across a function's arguments.
Note: if you're using an es6 runtime or compiler (such as babel), check out destructuring of parameters. It's a faster and prettier approach to the problem smear solves.
Smear turns a function that would normally take comma-separated parameters and turns it into one that takes a single parameter -- an array. Technically it unspreads the function.
This is particularly useful with promises, which must resolve to a single value (much like a synchronous return value). Some Promise implementations will add a .spread() function to the Promise prototype, but this is a non-standard interface and is incompatible with native promises.
Turns this:
Promise.resolve([1, 2, 3]).then(function (args) {
var one = args[0];
var two = args[1];
var three = args[2];
})
into this:
Promise.resolve([1, 2, 3]).then(spread(function (one, two, three) {
console.log('much better!');
}));
function smear(fn)
fn - a function accepting a comma-separated list of parameters.
Smear returns a new function that accepts a single parameter of an array, and spreads it out to fn.
FAQs
Spread an array parameter to a function
We found that smear 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.