5 snippets · production-ready JavaScript & TypeScript
A production-ready TypeScript WorkerPool class that maintains a pool of Web Workers, automatically distributes tasks to idle workers, queues tasks when all workers are busy, and provides type-safe Promise-based results.
A production-ready memoization utility that intelligently caches function results using WeakMap for object arguments (preventing memory leaks) and Map for primitive values, with support for custom cache key serialization.
A framework-agnostic TypeScript utility that calculates which items should be rendered in a virtual scrolling list based on scroll position, container dimensions, and item metrics.
A TypeScript utility that deduplicates concurrent requests by sharing a single in-flight promise among all callers requesting the same resource, preventing redundant network calls and improving application performance.
A fully-featured Least Recently Used (LRU) cache implementation in TypeScript with O(1) get/set/delete operations, optional time-to-live per entry, and customizable eviction callbacks.