{"size": 923, "ext": "js", "max_stars_repo_path": "src/common/validate.js", "max_stars_repo_name": "clam314/blog-admin-api", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/common/validate.js", "max_issues_repo_name": "clam314/blog-admin-api", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/common/validate.js", "max_forks_repo_name": "clam314/blog-admin-api", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.5111111111, "max_line_length": 79, "alphanum_fraction": 0.5373781148}
export const validateEmail = value => {
  value = String(value)
  if (!value || value === '') {
    return false
  }
  if (value !== '') {
    const reg = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
    if (!reg.test(value)) {
      return false
    }
  }
  return true
}

export const validateMobilePhone = (value) => {
  value = String(value)
  if (!value || value === '') {
    return false
  }
  if (value !== '') {
    const reg = /^1[3456789]\d{9}$/
    if (!reg.test(value)) {
      return false
    }
  }
  return true
}

export const validateStrLength = (value, min = 0, max = 0) => {
  value = String(value)
  if (!value || value === '') {
    return false
  } else if (min > 0 && value.length < min) {
    return false
  } else if (max > 0 && value.length > max) {
    return false
  } else {
    return true
  }
}

export const notNullObj = (obj) => {
  return Object.keys(obj).length > 0
}
