faker
faker copied to clipboard
Always use max param as exclusive value
Clear and concise description of the problem
All functions in JS uses a min or start value inclusive and an max or end value exclusive Faker doesn't respect this and uses max or end as inclusive A JS developer would not expect this behavior and would need to read the docs
Suggested solution
Use max as exclusive value
Alternative
No response
Additional context
Example: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring
I looked a bit into the code, and somehow applying this change feels wrong :thinking: I'm not so sure anymore if we want this
Some example usages like generating a color between 0 and 255 it feels more practical to just use int({ min: 0, max: 255 })
I looked a bit into the code, and somehow applying this change feels wrong 🤔 I'm not so sure anymore if we want this
Some example usages like generating a color between 0 and 255 it feels more practical to just use
int({ min: 0, max: 255 })
It does feel more practical to me too, but it goes against JS conventions with what you said about the exclusive end value, so I'm not too sure, we should discuss this at the next meeting.
Team decision
- We don't see the necessity to change this atm.
- We will reconsider it, if there is greater user interest.