koajs / koajs/ratelimit

[feat] max/duration option to use a function

Open
#71 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
493
Forks
56
PR merge metrics
No merged PRs in 30d

Description

I'm willing to writing a feature where you can provide either an integer or a function for max and duration.
It could work like the "id" field where ctx is available.

max: Integer|function
duration: Integer|function

Would you be open to this feature?

Contributor guide

Open the contributing guide

Research direction

Start by reviewing how the existing id option makes ctx available; the issue does not name a file, entry point, or test. Clarify the behavior for function-valued max and duration, including when each function runs and what constitutes done, then add tests covering integer and function inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.