@jdsalasc/solvejs-async
v1.6.0
Published
Zero-dependency JavaScript/TypeScript async utilities for production: sleep, promise timeout, retry with backoff, and concurrency-limited pMap.
Maintainers
Readme
@jdsalasc/solvejs-async
Zero-dependency async/concurrency utilities for JavaScript and TypeScript.
Utilities
sleeptimeoutretrypMapdebouncePromisethrottlePromise
When to use this package
Use it when you need predictable retry logic, promise time limits, and controlled async concurrency without adding heavy helper libraries.
Limitations and Constraints
throttlePromisedrops calls made during the throttle window.debouncePromisecancels previous pending calls with a rejection.- Queueing/rate-limit orchestration is intentionally out of scope for now.
Install
npm i @jdsalasc/solvejs-asyncQuick example
import { retry, timeout, pMap } from "@jdsalasc/solvejs-async";
const data = await retry(
() => timeout(fetch("https://api.example.com/items").then((r) => r.json()), 3000),
{ retries: 2, delayMs: 200, backoffFactor: 2 }
);
const ids = await pMap(data.items, async (item) => item.id, { concurrency: 4 });