{"name":"throttleit","version":"2.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","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"}},"gitHead":"3b06de30521b81c7fe283df279b90d0e20a8dd42","bugs":{"url":"https://github.com/sindresorhus/throttleit/issues"},"homepage":"https://github.com/sindresorhus/throttleit#readme","_id":"throttleit@2.0.0","_nodeVersion":"20.9.0","_npmVersion":"9.2.0","dist":{"integrity":"sha512-9VImOCJfOMzgBNJIa8ifGnJbAY3XGkl+mGV/+N69+L07QXrg6B6FqPI+2MCqdO5Ojega5BsA94zKHh2rHsQW9Q==","shasum":"b118da15e6062ec1daf448166e9a0378807401b7","tarball":"http://registry-npm.ywwl.com/throttleit/download/throttleit-2.0.0.tgz","fileCount":5,"unpackedSize":4920,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+nUYA8ZvSZ6PLSsYKq6fCluzjK1RnwQXA8JZGCSGkwQIhAIf3DNuHoLfIKQZmQc+JSgu4RrqvH8ZxopVAedD2TUB/"}],"size":2122,"noattachment":false,"key":"/throttleit/-/throttleit-2.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"coreh","email":"thecoreh@gmail.com"},{"name":"swatinem","email":"arpad.borsos@googlemail.com"},{"name":"timaschew","email":"timaschew@gmail.com"},{"name":"anthonyshort","email":"antshort@gmail.com"},{"name":"ianstormtaylor","email":"ian@ianstormtaylor.com"},{"name":"cristiandouce","email":"cristiandouce@gmail.com"},{"name":"stagas","email":"gstagas@gmail.com"},{"name":"rauchg","email":"rauchg@gmail.com"},{"name":"kelonye","email":"kelonyemitchel@gmail.com"},{"name":"amasad","email":"amjad.masad@gmail.com"},{"name":"trevorgerhardt","email":"trevorgerhardt@gmail.com"},{"name":"juliangruber","email":"julian@juliangruber.com"},{"name":"dominicbarnes","email":"dominic@segment.com"},{"name":"dfcreative","email":"df.creative@gmail.com"},{"name":"mattmueller","email":"mattmuelle@gmail.com"},{"name":"tootallnate","email":"nathan@tootallnate.net"},{"name":"yields","email":"yields@icloud.com"},{"name":"stephenmathieson","email":"me@stephenmathieson.com"},{"name":"retrofox","email":"rdsuarez@gmail.com"},{"name":"sindresorhus","email":"sindresorhus@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},{"name":"calvinfo","email":"calvin@calv.info"},{"name":"defunctzombie","email":"shtylman@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/throttleit_2.0.0_1700221877293_0.2565643052159827"},"_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":1700221877496,"_cnpm_publish_time":1700221877496,"dist-tags":{"latest":"3.0.0"}}