isEmail.js 213 B

1234567891011
  1. /**
  2. * @desc 判断是否为邮箱地址
  3. * @param {String} str
  4. * @return {Boolean}
  5. */
  6. const isEmail = (str) => {
  7. return /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(str)
  8. }
  9. module.exports = isEmail