1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| const email = email => { const reg = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/; if(reg.test(email)) return true return false }
const min = (str, len) => { if(str.length >= len) return true return false }
const max = (str, len) => { if(str.length <= len) return true return false }
const confirm = (str1, str2) => { if(str1 == str2) return true return false }
const phone = phone => { const reg = /^1[3-9][0-9]{9}$/; if(reg.test(phone)) return true return false }
module.exports = { email, min, max, confirm, phone }
|