xavi- / node-simple-rate-limiter

A simple way to rate limit how often a function is executed.
76 stars 10 forks source link

The rate-limited return object loses some function behavior #2

Closed robludwig closed 1 year ago

robludwig commented 8 years ago

I'm having an issue where I rate limit an async function that accepts a callback and then I pass that rate-limited function to another library, node-stream-worker. That library checks the arity of the function and uses that to determine whether it uses async callbacks or promises. The issue arises because my original function required 2 arguments and had a .length of 2, but after it passes through your rate limiter, its .length is undefined.

I'm wondering if you would accept a pull request where I add some additional properties to the limiter object returned by the library to make the limiter appear to be more like a function. I'd like to implement at least .length, but there is a whole world of possible behaviors to implement.