const isEmail = ( message ) => ( value ) => { const regexEmail = /^(([^<>()[\]\\.,;:\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,}))$/ ; return ! regexEmail . test ( value ) ? message : undefined ; } ; const required = ( message ) => ( value ) => ! value ? message : undefined ; const min = ( size , message ) => ( value ) => value && value . length < size ? message : undefined ; const max = ( size , message ) => ( value ) => value && value . length > size ? message : undefined ; const composeValidators = ( ... validators ) => ( value ) => validators . reduce ( ( error , validator ) => error || validator ( value ) , undefined ) ; export default { isEmail , required , min , max , composeValidators } ;