const isValidEmail = ( email ) => email . match ( /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i ) ; const isValidPassword = ( password ) => password . match ( /^(?:(?=.*?[A-Z])(?:(?=.*?[0-9])(?=.*?[-!@#$%^&*()_[\]{},.<>+=])|(?=.*?[a-z])(?:(?=.*?[0-9])|(?=.*?[-!@#$%^&*()_[\]{},.<>+=])))|(?=.*?[a-z])(?=.*?[0-9])(?=.*?[-!@#$%^&*()_[\]{},.<>+=]))[A-Za-z0-9!@#$%^&*()_[\]{},.<>+=-]{7,50}$/ ) ; const validators = { email : isValidEmail , password : isValidPassword } ; summary param key export const getValidatorByKey = ( key ) : any => Object . prototype . hasOwnProperty . call ( validators , key ) ? validators [ key ] : null ; export default { isValidEmail , isValidPassword , } ;