Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
stack-promises
Advanced tools
A stack of tasks that are executed one by one, but the result is taken from the last. Identical functions on the stack (check by reference) are executed only once.
npm
npm install stack-promises
yarn
yarn add stack-promises
import creteStackPromises from 'stack-promises';
const stackPromises = creteStackPromises();
stackPromises.add(() => Promise.resolve(1));
stackPromises.add(() => Promise.resolve(2));
stackPromises().then(data => {
console.log(data); /// 2
});
import creteStackPromises from 'stack-promises';
const stackPromises = creteStackPromises();
stackPromises
.add(() => Promise.resolve(1))() // execute
.then(data => {
console.log(data); // 1
});
stackPromises
.add(() => Promise.resolve(2))() // execute
.then(data => {
console.log(data); // 2
});
stackPromises().then(data => {
console.log(data); // 2
});
import creteStackPromises, { isPromiseIsNotActualError } from 'stack-promises';
import delayPromise from 'promise-delay';
const stackPromises = creteStackPromises();
let checkQue = 0;
const request1 = () =>
delayPromise(3000, 1).finally(() => {
checkQue += 1;
});
const resultAfter1 = stackPromises.add(request1)();
const request2 = () =>
delayPromise(1000, 2).finally(() => {
checkQue *= 2;
});
const resultAfter2 = stackPromises.add(request2)();
Promise.allSettled([resultAfter1, resultAfter2]).then(([{ reason }, { value }]) => {
isPromiseIsNotActualError(reason); // true
value; // 2
checkQue; // 2
// request1 called 1 times
// request2 called 1 times
});
stackPromises.add(() => Promise.resolve(1)).add(() => Promise.resolve(2));
npm test
Krivega Dmitriy
Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.
Copyright © 2020 Krivega Dmitriy.
This project is MIT licensed.
FAQs
sequentPromises resolves Promises sequentially
The npm package stack-promises receives a total of 0 weekly downloads. As such, stack-promises popularity was classified as not popular.
We found that stack-promises demonstrated a healthy version release cadence and project activity because the last version was released less than 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.