Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-retry

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-retry

A little retry tool in javascript/typescript for node.

  • 1.0.13
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
38K
decreased by-10.38%
Maintainers
1
Weekly downloads
 
Created
Source

ts-retry

A little retry tool in javascript/typescript for node.

How to:

  • to retry something: await retry(()=> {/* do something */}, {delay:100,maxTry:5})
  • to retry something async : await retryAsync(async ()=> {/* do something */}, {delay:100,maxTry:5})

Above examples make up to 5 attempts, waiting 100ms between each try.

API

  • retry(fn, retryOptions): call repeteadly fn until fn does not throw and exception. Stop after retryOptions.maxTry count. Between each call wait retryOptions.delay milliseconds. if stop to call fn after retryOptions.maxTry, throws fn execption, otherwise returns fn return value.
  • retryAsync(fn, retryOptions): same as retry, except fn is an asynchronous function.
  • retryOptions:
    • maxTry maximum calls to fn.
    • delay: delay between each call (in milliseconds).

Keywords

FAQs

Package last updated on 04 Jan 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc