{"name":"throttleit","version":"3.0.0","description":"Throttle a function to limit its execution rate","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/throttleit.git"},"funding":"https://github.com/sponsors/sindresorhus","type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=22"},"scripts":{"test":"xo && node --test"},"keywords":["throttle","rate","limit","limited","rate-limit","ratelimit","throttling","optimization","performance","function","execution","interval","batch"],"devDependencies":{"xo":"^4.0.0"},"gitHead":"af4e306b36b5625f38ecc9b6cda62fad5a4bd44d","types":"./index.d.ts","_id":"throttleit@3.0.0","bugs":{"url":"https://github.com/sindresorhus/throttleit/issues"},"homepage":"https://github.com/sindresorhus/throttleit#readme","_nodeVersion":"22.23.1","_npmVersion":"11.18.0","dist":{"integrity":"sha512-ewinRQ8oWJQ7R4hYkxW1ZlfG6UcMs8d4ExMTWhb1HU7ZQCU9HywgkxHEJrdlB4KJ3QrVvztXhIyIKGZMjrg2sg==","shasum":"6a8e8408197270649a85b994db9c119ac3f714cc","tarball":"http://registry-npm.ywwl.com/throttleit/download/throttleit-3.0.0.tgz","fileCount":5,"unpackedSize":5616,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDfFES08A8+gd+je0Q5qngQnM//pZMB4oKV4VFVOmU+TgIhAJfgtp3tYrSVVEH3aPLhJ6yz5D3cCBqvqTGfiWWcRZj7"}],"size":2311,"noattachment":false,"key":"/throttleit/-/throttleit-3.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/throttleit_3.0.0_1783777504717_0.5949968671392549"},"_hasShrinkwrap":false,"readme":"# throttleit\n\n> Throttle a function to limit its execution rate\n\n## Install\n\n```sh\nnpm install throttleit\n```\n\n## Usage\n\n```js\nimport throttle from 'throttleit';\n\n// Throttling a function that processes data.\nfunction processData(data) {\n\tconsole.log('Processing:', data);\n\n\t// Add data processing logic here.\n}\n\n// Throttle the `processData` function to be called at most once every 3 seconds.\nconst throttledProcessData = throttle(processData, 3000);\n\n// Simulate calling the function multiple times with different data.\nthrottledProcessData('Data 1');\nthrottledProcessData('Data 2');\nthrottledProcessData('Data 3');\n```\n\n## API\n\n### throttle(function, wait)\n\nCreates a throttled function that limits calls to the original function to at most once every `wait` milliseconds. It guarantees execution after the final invocation and maintains the last context (`this`) and arguments.\n\nThe throttled function returns the result of the most recent execution of the original function. When a call is deferred, it returns the result from the previous execution (or `undefined` if it has not executed yet).\n\n#### function\n\nType: `Function`\n\nThe function to be throttled.\n\n#### wait\n\nType: `number`\n\nThe number of milliseconds to throttle invocations to.\n\nMust be a non-negative finite number.\n\n## Related\n\n- [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle async functions\n- [debounce](https://github.com/sindresorhus/debounce) - Delay function calls until a set time elapses after the last invocation\n","publish_time":1783777504857,"_cnpm_publish_time":1783777504857,"dist-tags":{"latest":"3.0.0"}}