
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
An experiment with promises
@see example/example.js
var ahead = require('ahead');
Ahead provides a easy way to create promises. And lets you write asynchronous stuff that looks synchronous. Its thought as an experiment and not for real use. Error handling can get pretty confusing.
It adds two arguments to a function.
var random = ahead(function (delay, kept, broken) {
setTimeout(function () {
kept(Math.random());
}, delay);
});
var r = random(10); // creates a promise for a random number
r.then(function (number) { console.log(number);});
Functions created with ahead can take promises as arguments the execution gets deferred until all promised arguments are resolved
var multiply = ahead(function (a, b, keep) {
keep(a * b);
});
multiply(random(10), 3); // just looks synchronous
Ahead.shift converts a synchronous function (shifts it in time ahead).
var pow = ahead.shift(function (a, b) {
return Math.pow(a, b);
});
Lets shift console.log in time ahead
var log = ahead.shift(console.log.bind(console));
Thrown errors will break the promise
var fail = ahead.shift(function () {
throw Error("break everything");
});
All the above created functions can be used in a synchronous style but are executed asynchronous
log(pow(multiply(random(1000), 3), 2));
The returned value of each function created with ahead or ahead.shift is a promise for a future value
fail(random(1000), 3).then(
function success (value) {
},
function fail (reason) {
}
);
FAQs
An experiment with promises
The npm package ahead receives a total of 0 weekly downloads. As such, ahead popularity was classified as not popular.
We found that ahead 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.