function-threshold
Limit the amount of times a function can be called in a specific timeframe and throw an error if the limit is exceeded.
Installation
with npm
npm install function-threshold
with yarn
yarn add function-threshold
Example
var FunctionThreshold = ; { console;} // limit to 5 executions per 10 seconds (10.000 ms)var threshold = myFunction 5 10000; // call the function somewhere. It will throw an exception if limit is exceededthreshold;