
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
@abuhasanrumi/micro-flow
Advanced tools
A tiny utility for debouncing, throttling, and dynamic rate-limiting
A tiny (364b) JavaScript utility for debouncing, throttling, and dynamic rate-limiting. Built for performance and simplicity, micro-flow helps developers optimize event-driven applications with minimal overhead.
micro-flow is a lightweight library designed to handle rate-limiting tasks in JavaScript with ease. Whether you're optimizing scroll events, search inputs, or API calls, this package provides three core functions—debounce, throttle, and dynamic—to ensure your code runs efficiently. With a focus on modern JavaScript, TypeScript support, and a tiny footprint, micro-flow is perfect for projects where performance and bundle size matter.
As a developer, I noticed that many rate-limiting libraries were either bloated with dependencies or lacked flexibility for modern workflows. I wanted to create a solution that was:
dynamic function adapts wait times based on call frequency, a feature not commonly found in other libraries.This package was also a way for me to deepen my understanding of JavaScript performance patterns while contributing a practical tool to the open-source community. It’s a showcase of clean code, rigorous testing, and developer-friendly design.
While there are other debounce and throttle libraries like lodash.debounce, throttle-debounce, or just-debounce-it, @abuhasanrumi/micro-flow stands out in several ways:
micro-flow is under 364b minified, ideal for performance-critical apps.dynamic function adjusts wait times based on how frequently it’s called, offering smarter rate-limiting for variable workloads (e.g., search inputs with bursts of typing).micro-flow is standalone, reducing bloat and security risks.If you need a minimal, flexible, and forward-thinking rate-limiting solution, micro-flow is designed for you.
Install via npm:
npm install @abuhasanrumi/micro-flow
Prevents a function from running until a specified delay has passed since its last call. Great for search inputs or resize events.
import { debounce } from '@abuhasanrumi/micro-flow';
const log = debounce(() => console.log('Debounced!'), 200);
window.addEventListener('resize', log);
// Rapid resizes trigger only one console.log after 200ms
Limits a function to run at most once every specified interval. Perfect for scroll or mouse-move events.
import { throttle } from '@abuhasanrumi/micro-flow';
const update = throttle(() => console.log('Throttled!'), 100);
window.addEventListener('scroll', update);
// Logs at most once every 100ms during scrolling
Adapts the wait time based on call frequency, using a base wait and scaling up to a maximum. Ideal for dynamic inputs like typing or IoT events.
import { dynamic } from '@abuhasanrumi/micro-flow';
const search = dynamic(() => console.log('Searching...'), { baseWait: 200, maxWait: 1000 });
document.getElementById('search').addEventListener('input', search);
// Frequent typing uses ~200ms wait; sparse typing extends up to 1000ms
dynamic function adjusts wait times for smarter performance.Try @abuhasanrumi/micro-flow in action:
See debounce on a search input, throttle on scroll events, and dynamic with adaptive typing—all in a simple, interactive example.
debounce(fn, wait)fn after wait ms of inactivity.throttle(fn, wait)fn at most once per wait ms.dynamic(fn, options)baseWait: Minimum wait time in milliseconds (e.g., 200).maxWait: Maximum wait time in milliseconds (e.g., 1000).fn with a wait time that adapts based on call frequency.To contribute or run locally:
Clone the repo:
git clone https://github.com/abuhasanrumi/micro-flow.git
cd micro-flow
Install dependencies:
npm install
Run tests:
npm test
Build the package:
npm run build
Copyright (c) 2025 Abu Hasan Rumi
Built as a learning project to explore JavaScript performance patterns and contribute to the open-source community. Feedback and contributions are welcome!
FAQs
A tiny utility for debouncing, throttling, and dynamic rate-limiting
We found that @abuhasanrumi/micro-flow demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.