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(int-value): fix int-value validation (DEV-1277) #815
Conversation
@@ -87,7 +87,7 @@ export class IntValueComponent extends BaseValueDirective implements OnInit, OnC | |||
|
|||
const newIntValue = new CreateIntValue(); | |||
|
|||
newIntValue.int = this.valueFormControl.value; | |||
newIntValue.int = parseInt(this.valueFormControl.value, 10); |
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.
The 10 looks like a magic number to me. It would be more readable to do something like:
const DEFAULT_VALUE = 10
newIntValue.int = parseInt(this.valueFormControl.value, DEFAULT_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.
Yeah, it's technically optional but the linter complains. I've replaced in with a const in fea1417
@@ -105,7 +105,7 @@ export class IntValueComponent extends BaseValueDirective implements OnInit, OnC | |||
|
|||
updatedIntValue.id = this.displayValue.id; | |||
|
|||
updatedIntValue.int = this.valueFormControl.value; | |||
updatedIntValue.int = parseInt(this.valueFormControl.value, 10); |
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.
look above
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.
Just small improvements
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.
LGTM
resolves DEV-1277