validations.js 447 Bytes
export const isRequired = value => !value && 'Required'

export const minLength = minLength => {
  return value => value && value.length < minLength && `Min. length: ${minLength}`
}

export const isValidEmail = value => {
  const exR = /^(([^<>()\[\]\\.,;:\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 !exR.test(value) && 'Please use a valid email'
}