{"name":"throttleit","version":"2.1.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","exports":{"types":"./index.d.ts","default":"./index.js"},"main":"./index.js","types":"./index.d.ts","sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava"},"keywords":["throttle","rate","limit","limited","rate-limit","ratelimit","throttling","optimization","performance","function","execution","interval","batch"],"devDependencies":{"ava":"^5.3.1","xo":"^0.56.0"},"xo":{"rules":{"unicorn/prefer-module":"off"}},"_id":"throttleit@2.1.0","gitHead":"ed1d22c70a964ef0299d0400dbfd1fbedef56a59","bugs":{"url":"https://github.com/sindresorhus/throttleit/issues"},"homepage":"https://github.com/sindresorhus/throttleit#readme","_nodeVersion":"22.2.0","_npmVersion":"10.6.0","dist":{"integrity":"sha512-nt6AMGKW1p/70DF/hGBdJB57B8Tspmbp5gfJ8ilhLnt7kkr2ye7hzD6NVG8GGErk2HWF34igrL2CXmNIkzKqKw==","shasum":"a7e4aa0bf4845a5bd10daa39ea0c783f631a07b4","tarball":"http://registry-npm.ywwl.com/throttleit/download/throttleit-2.1.0.tgz","fileCount":5,"unpackedSize":5133,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC3jHFLKmiqd6UUXwUtDBEBnND9HjYRoOpWCqGRAGPdtAiBJBXLM5B7h4cTx0mO9UEvo4Fsy2ZHgNRlN5/X1INkP3Q=="}],"size":2250,"noattachment":false,"key":"/throttleit/-/throttleit-2.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/throttleit_2.1.0_1719010258168_0.8806595942049604"},"_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\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\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":1719010258348,"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_cnpm_publish_time":1719010258348,"dist-tags":{"latest":"3.0.0"}}