Created
August 28, 2018 17:48
-
-
Save kaweski/cfe8fcbf2ca8afba24d2cec9dc32ea5d to your computer and use it in GitHub Desktop.
Valida telefones do Brasil com DDD, o 9º dígito e obrigatoriamente contendo 9 dígitos, mais espaços e caracteres de separação.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let regex = /^\([1-9]{2}\) 9 [7-9][0-9]{3}\-[0-9]{4}$/; | |
if( regex.test(c.value) ) { | |
return null; | |
} else { | |
return { phoneError: true }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe the code can be refactoring, like this: