UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

21 lines (20 loc) 688 B
export async function withRetry(operation, options) { const { maxRetries, baseDelayMs, maxDelayMs = 30000, shouldRetry } = options; let lastError; for (let attempt = 0; attempt <= maxRetries; attempt++) { try { return await operation(); } catch (error) { lastError = error; if (shouldRetry && !shouldRetry(lastError)) { throw lastError; } if (attempt < maxRetries) { const delay = Math.min(baseDelayMs * 2 ** attempt, maxDelayMs); await new Promise((resolve) => setTimeout(resolve, delay)); } } } throw lastError; }