Create a token bucket algorithm in Javascript
Is useful when you have to throtle something, example in a rate limiter API
A token bucket is a container that has a default capacity, tokens are put in the bucket at preset rates periodically. Once the bucket is full, no more tokens are added, the extra tokens will overflow
- Token bucket
- Leaking bucket