improved code readability (comment from PR #18)

This commit is contained in:
GotPPay
2018-04-11 10:49:12 +02:00
parent e138c6e09e
commit 4ac7284724
2 changed files with 6 additions and 3 deletions

View File

@@ -40,7 +40,8 @@ class Contact extends Component {
}
handleEmailEdit(e){
if (e.length === EMAIL_MAX_LENGTH) return;
const isEmailInvalid = e.length >= EMAIL_MAX_LENGTH;
if (isEmailInvalid) return;
this.setState({contactEmail: e});
}
}

View File

@@ -52,12 +52,14 @@ class LaunchRequest extends Component {
}
handleNameEdit(e){
if (e.length === INVOCATION_NAME_MAX_LENGTH || !(/^[a-z,.' ]*$/.test(e))) return;
const isInvocationNameInvalid = e.length === INVOCATION_NAME_MAX_LENGTH || !(/^[a-z,.' ]*$/.test(e));
if (isInvocationNameInvalid) return;
this.setState({invocationName: e});
}
handleAnswerEdit(e){
if (e.length === INVOCATION_ANSWER_MAX_LENGTH || !(/^[a-z,.' ]*$/i.test(e))) return;
const isInvocationAnswerInvalid = e.length === INVOCATION_ANSWER_MAX_LENGTH || !(/^[a-z,.' ]*$/i.test(e));
if (isInvocationAnswerInvalid) return;
this.setState({invocationAnswer: e});
}
}