-
-
Notifications
You must be signed in to change notification settings - Fork 950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strictly return a word with given length #721
Comments
I think for some values it might be hard to keep the exact length (like when |
It's not that simple, because then users would loose current behavior to generate an exact length word |
Well, the current behavior is actually |
I agree those functions could have 2 signatures: function xyz (maxLength: number)
function xyz (options: { minLength?: number, maxLength?: number}) |
No it's not. The current behavior is: if length match was found use exact length, if not fallback to random length. |
Which means that current |
As the word functions currently use desiredLength we should keep this as the default. Maybe adding other variants as an option. I suggest this signature That way it would be non breaking. v6.2 at the earliest. |
On the first looks that looks good |
This got solved with #1407. |
Clear and concise description of the problem
#714 (comment)
MO it feels a bit weird if a word with given length is not found then use random length 🤔
IMO we should change behavior for all such cases to a min/max length and search between that. If nothing found return undefined or throw an error?
Suggested solution
We need to discuss whether we should return undefined, null or an error in such a case
Alternative
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: