/* eslint no-useless-escape: 0 */
var regex = {
  email: /^(([^<>()\[\]\\.,;:\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,}))$/,
  phone: /\d\d\d-\d\d\d-\d\d\d\d/,
  time: /^\d{2}:\d{2} (am|pm)$/
};
export var isEmptyText = function isEmptyText(value) {
  return !value || typeof value !== 'string' ? 'Required' : undefined;
};
export var isEmptyRadio = function isEmptyRadio(value) {
  return !value && Number.isNaN(Number(value)) ? 'Required' : undefined;
};
export var isEmptyCheck = function isEmptyCheck(value) {
  return value && value.length ? undefined : 'Required';
};
export var isValidEmail = function isValidEmail(value) {
  return !!value && !regex.email.test(value) ? 'Invalid email. Must be in example@domain.com format.' : undefined;
};
export var isValidPhone = function isValidPhone(value) {
  return !!value && !regex.phone.test(value) ? 'Invalid Phone Number. Must be in 999-999-9999 format.' : undefined;
};
export var isInvalidDate = function isInvalidDate(value) {
  return !value ? 'Invalid Date, please select from the date picker.' : undefined;
};
export var isEmptyTime = function isEmptyTime(value) {
  return !value || !regex.time.test(value) ? 'Required' : undefined;
};
export var isValidZip = function isValidZip(zip) {
  return zip && zip.match(/^\d{5}$/) ? undefined : 'Please enter a 5 digit zip code. Ex: 95628';
};