home/coding/prompt-74

Prompt

GPTClaudeDeepSeek··1,282 copies·updated 2026-07-14
prompt-74.prompt
Write a JavaScript async function `retry(fn, options)` that calls the async function `fn` and
retries it on rejection with exponential backoff.

- `options.retries` (default 3) is the number of *additional* attempts after the first, so the
  total number of calls is at most `retries + 1`.
- `options.baseDelay` (default 100, ms) — wait `baseDelay * 2 ** attempt` before each retry
  (attempt index starting at 0).
- Resolve with `fn`'s value on the first success. If every attempt rejects, throw the last error.

Put it in a single JavaScript code block and `module.exports = retry` (or `{ retry }`).

fill the variables

This prompt has 1 variable. Pro fills them into a ready-to-paste prompt for you — no manual find-and-replace.

{retry}
Unlock with Pro →

when to use it

Community prompt sourced from the open-source GitHub repo Green-PT/honey-for-devs (MIT). A "Prompt" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

codingcommunitydeveloper

source

Green-PT/honey-for-devs · MIT