Created
July 29, 2020 07:10
-
-
Save longtc/24eee072ed3b57df48001ed44df33f2b to your computer and use it in GitHub Desktop.
This file contains 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
const contentType = { | |
urlEncoded: 'application/x-www-form-urlencoded', | |
json: "application/json; charset=utf-8" | |
}; | |
const headers = { | |
"Accept": "application/json, text/*" | |
}; | |
// Validator | |
// http://emailregex.com/ | |
export function validateEmail(email) { | |
// eslint-disable-next-line no-useless-escape | |
return /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test( | |
String(email).toLowerCase(), | |
); | |
} | |
export function validatePhone(phone) { | |
return String(phone).match(/^[0-9\b-.]+$/); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment