@utilify/core
Version:
Modern, strongly typed, and safe utility function library for JavaScript and TypeScript. Includes type checking, manipulation of arrays, objects, strings, dates, colors, numbers, regular expressions, and more. Compatible with Browser, Node.js, Deno, and B
16 lines • 634 B
TypeScript
/**
* @callback RateLimitCallback
* @param {...any} args
* @returns {any}
*/
/**
* Creates a rate-limited function.
* @template T
* @param {RateLimitCallback} callback - The function to rate limit.
* @param {number} limit - Maximum calls per interval.
* @param {number} interval - Interval in milliseconds.
* @returns {(...args: Parameters<T>) => boolean} The rate-limited function.
* @throws {TypeError} If parameters are invalid.
*/
export default function rate<T extends (...args: any[]) => any>(callback: T, limit: number, interval: number): (...args: Parameters<T>) => boolean;
//# sourceMappingURL=rateLimit.d.ts.map