@ts-utilkit/async
v0.2.0
Published
Asynchronous operation utilities for retry logic, timeouts, parallel execution, and promise management
Maintainers
Readme
@ts-utilkit/async
Asynchronous operation utilities for retry logic, timeouts, parallel execution, and promise management.
Installation
npm install @ts-utilkit/asyncFeatures
- 🚀 Production-ready async patterns
- ⚡ Retry with exponential backoff
- ⏱️ Promise timeout handling
- 🔄 Controlled parallel execution
- 📦 Series execution with error handling
- ✅ Comprehensive test coverage
Available Functions (6)
asyncFilter- Filter array with async predicateasyncMap- Map array with async functionasyncParallel- Execute multiple async operations with concurrency limitasyncRetry- Retry failed operations with exponential backoffasyncSeries- Execute async operations sequentiallyasyncTimeout- Add timeout to any promise
Quick Example
import { asyncRetry, asyncTimeout, asyncParallel } from '@ts-utilkit/async';
// Retry with exponential backoff
await asyncRetry(() => fetchAPI(), 3, 1000);
// Add timeout to promise
await asyncTimeout(slowPromise, 5000);
// Control parallel execution
await asyncParallel([fn1, fn2, fn3], 2);License
MIT © Mykyta Forofontov
