jhurliman / node-rate-limiter

A generic rate limiter for node.js. Useful for API clients, web crawling, or other tasks that need to be throttled
MIT License
1.5k stars 132 forks source link

Invalid period strings should be rejected #42

Closed CapacitorSet closed 6 years ago

CapacitorSet commented 7 years ago

If you use an invalid period string, eg. because of a typo (new RateLimiter(10, "horu")), the library will fallback to "second", rather than throwing an error. This fallback is completely unexpected, and can cause outright wrong behaviour in the event of typos (as just happened to me).