fix(number): validationNumber 불 필요한 검증 로직 제거 #378
+2
−2
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.
Overview
as-is
기존 as-is 로직은 다음과 같은 과정으로 진행합니다.
하지만
Number.isInteger가 앞쪽에 위치한다면 불 필요한 검증을 줄여 코드를 개선 할 수 있습니다.to-be
Number.isInterger를 통해
Infinity,-Infinity,NaN,실수체크를 한번에 처리할 수 있습니다.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger#using_isinteger
검증 로직의
!Number.isInteger(num)이후 순서부터는 num은정수임을 보장하기 때문에 이제 범위 체크만을 진행 함으로써 검증 로직을 개선해볼 수 있습니다.PR Checklist