-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix boolean transformer error #132
Conversation
@rrgks6221 @ohchanghoon pr 다시 열었습니다. |
return value === 'true' || value === '1' | ||
? true | ||
: value === 'false' || value === '0' | ||
? false | ||
: value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
상항연산자가 2개 이상 들어갈때는 if문이 더 단순하게 짜여질 수 있으니 고려해보면 좋을듯합니다.
@@ -0,0 +1,7 @@ | |||
export function transformStringToBoolean({ value }) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
순수한 js function이여서 testcode 연습겸 짜보면 좋을거같아요
Description
기존에 BooleanString인지 검사하고 boolean으로 transform 하는 로직에 에러가 있었어서 이를 고쳤습니다.
To Reviewer
validator와 transformer중 transformer가 먼저 실행됨.(그 와중에 무조건 어떤 값이든 true로 변환시킴)
먼저 transformer로 mapper 내에 존재하는 값으로 변환시킴('undefined' --> undefined, 'true' --> true, 'false' --> false)
그 후 IsBoolean validator로 검사
Reference Link
typestack/class-transformer#676
Related Issue Link
QYOG-68
API