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.
promise-again
Advanced tools
Yet another wrapper for functions that returns promise to retry rejected attempts. But this one with advanced **flexibility**.
Yet another wrapper for functions that returns promise to retry rejected attempts.
But this one with advanced flexibility.
import promiseAgain from 'promise-again';
function someFunctionReturningAPromise() {
...
}
const wrappedFunction = promiseAgain(
/**
* A function that returns a promise
**/
someFunctionReturningAPromise,
{
/**
* Optional. Delay in milisecconds or a function that returns a delay
* or a function that returns a promise that resolves to a delay.
*
* @param reason - reason of the last rejection;
* @param attempt - number of used attempts;
* @param ...args - last attempt arguments;
*
* @returns {number | Promise<number>} - modified arguments to be used in the next attempt or a promise that is resolved to such arguments;
**/
delay: 1000, /*number | ((attempt: number, ...args: any[]) => number | Promise<number>)*/
/**
* Required. Number of attempts or function that returns true or a Promise that resolved to true if retry is needed;
*
* @param reason - reason of the last rejection;
* @param attempt - number of used attempts;
* @param ...args - last attempt arguments;
*
* @returns {boolean | Promise<any[]>} - modified arguments to be used in the next attempt or a promise that is resolved to such arguments;
**/
attempts: 10, /*number | ((attempt: number, ...args: any[]) => boolean | Promise<boolean>);*/
/**
* Optional. Function that is called before every retry attempt to modify next attempt arguments;
*
* @param reason - reason of the last rejection;
* @param attempt - number of used attempts;
* @param ...args - last attempt arguments;
*
* @returns {any[] | Promise<any[]>} - modified arguments to be used in the next attempt or a promise that is resolved to such arguments;
**/
retryArgumentsInterceptor: (reason, attempt, ...args) => args /*(reason: any, attempt: number, ...args: any[]) => any[] | Promise<any[]>;*/
}
)
wrappedFunction().then();
FAQs
Yet another wrapper for functions that returns promise to retry rejected attempts. But this one with advanced **flexibility**.
The npm package promise-again receives a total of 0 weekly downloads. As such, promise-again popularity was classified as not popular.
We found that promise-again 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
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.