8 snippets · production-ready JavaScript & TypeScript
A reusable TypeScript async generator function that handles API pagination automatically, fetching pages sequentially and yielding items until all data is retrieved.
A TypeScript utility function that wraps any promise and automatically rejects with a custom TimeoutError if the promise doesn't resolve within a specified time limit.
A production-ready async retry utility that implements exponential backoff with jitter. Supports configurable max attempts, base delay, max delay cap, and an optional error filter predicate to selectively retry specific errors.
A complete implementation of the Observable pattern in TypeScript, featuring core operators (map, filter, take) and demonstrating reactive event stream handling without external dependencies.
A production-ready TypeScript Semaphore implementation that controls concurrent async operations, featuring acquire/release semantics and automatic cleanup for rate-limiting scenarios.
A TypeScript utility that wraps Promise.allSettled and provides strongly-typed discriminated unions for success and failure results, with type guard helpers for easy filtering.
A TypeScript implementation of an async queue that processes tasks with a configurable concurrency limit, ensuring controlled parallel execution of asynchronous operations.
A production-ready debounce utility specifically designed for async functions. It cancels previous pending calls and always resolves with the result of the most recent invocation.