This adds the getTokensRemaining-method to RateLimiter.
An example can be found in the new README.md:
var RateLimiter = require('limiter').RateLimiter;
var limiter = new RateLimiter(1, 250);
// returns 1 since we did not remove a token and
// our number of tokens per interval is 1
limiter.getTokensRemaining();
Getting the number of tokens left was also possible without this method by doing limiter.tokenBucket.content, but I think having a special method for this is nicer and cleaner.
This adds the
getTokensRemaining
-method toRateLimiter
. An example can be found in the newREADME.md
:Getting the number of tokens left was also possible without this method by doing
limiter.tokenBucket.content
, but I think having a special method for this is nicer and cleaner.