/**
 * @param {string} path
 * @returns {Boolean}
 */
export function isExternal(path) {
  return /^(https?:|mailto:|tel:)/.test(path)
}

/**
 * @param {string} email
 * @returns {Boolean}
 */
export function validEmail(email) {
  return /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(email)
}

/**
 * @param {string} code
 * @returns {Boolean}
 */
export function validCode(code) {
  return /^[0-9]{6}$/.test(code)
}

/**
 * @param {string} pwd
 * @returns {Boolean}
 */
export function validPwd(pwd) {
  return /^[a-zA-Z]\w{5,7}$/.test(pwd)
}
