Skip to content
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

Mm 40 correct entry of non alphabetic characters #141

Merged
merged 8 commits into from Dec 7, 2021

Conversation

farpires
Copy link
Contributor

@farpires farpires commented Dec 3, 2021

  • validacion de caracteres especiales
  • utilización de Alert de react-nativ
validacion2.mp4

return Validations.isName(this.state.firstName) && Validations.isName(this.state.lastName);
return Validations.isName(this.state.firstName) && Validations.isName(this.state.lastName);
}
private specialCharacter(): boolean {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si vamos a verificar por letras, con esta expresión es más claro /^(?:[A-Za-z])+$. Podemos hacer algo del estilo

const regExp = /^(?:[A-Za-z])+$;
const correctedFirstName = regExp.test(this.state.firstName);
const correctedLastName = regExp.test(this.state.lastName);

if (correctedTextLastName === this.state.lastName) {
correctedLastName = true;
}
if (correctedFirstName === true && correctedLastName === true) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Para el return, se puede simplificar mediante

return correctedFirstName && correctedLastName

@MatiasOS MatiasOS merged commit 5425a94 into develop Dec 7, 2021
@MatiasOS MatiasOS deleted the MM-40-correct-entry-of-non-alphabetic-characters branch December 7, 2021 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants