lib: refactor to use validateInteger#45772
Merged
nodejs-github-bot merged 2 commits intoFeb 3, 2023
Merged
Conversation
deokjinkim
force-pushed
the
221208_use_min_max_validatenumber
branch
from
December 7, 2022 15:51
4d67a36 to
1bbbed3
Compare
validateNumbervalidateNumber
Fix NumberIsNaN is called two times and change error code to ERR_OUT_OF_RANGE when RangeError is occurred in test.
deokjinkim
force-pushed
the
221208_use_min_max_validatenumber
branch
from
December 7, 2022 15:57
1bbbed3 to
89113b8
Compare
aduh95
reviewed
Dec 7, 2022
|
|
||
| if (NumberIsNaN(percentile) || percentile <= 0 || percentile > 100) | ||
| throw new ERR_INVALID_ARG_VALUE.RangeError('percentile', percentile); | ||
| validateNumber(percentile, 'percentile', 1, 100); |
Contributor
There was a problem hiding this comment.
This forbids all the numbers between 0 and 1 that were previously allowed.
Contributor
Author
There was a problem hiding this comment.
My bad. I can't use min/max of validateNumber here because zero have not to be allowed for percentile. Instead, I changed error code to ERR_OUT_OF_RANGE. Plus, I find another place to use validateInteger. Please take a look when you are available.
validateNumbervalidateInteger
Use validateInteger for record and revise error code of percentile.
deokjinkim
force-pushed
the
221208_use_min_max_validatenumber
branch
from
December 7, 2022 23:37
9d44414 to
1830caf
Compare
jasnell
approved these changes
Dec 19, 2022
Collaborator
14 tasks
Collaborator
This was referenced Jan 20, 2023
Collaborator
This was referenced Jan 23, 2023
lpinca
approved these changes
Feb 2, 2023
Member
|
@nodejs/tsc this needs another approval. |
RaisinTen
approved these changes
Feb 3, 2023
Collaborator
|
Landed in 88d71dc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use validateInteger for record and revise error code of percentile.