Commit | Line | Data |
---|---|---|
1 | export function checkNameEmail(o) { | |
2 | if (typeof o.name === "string") { | |
3 | if (o.name.length == 0) return "Empty name"; | |
4 | if (!o.name.match(/^[\w]+$/)) return "Bad characters in name"; | |
5 | } | |
6 | if (typeof o.email === "string") { | |
7 | if (o.email.length == 0) return "Empty email"; | |
8 | if (!o.email.match(/^[\w.+-]+@[\w.+-]+$/)) return "Bad characters in email"; | |
9 | } | |
10 | return ""; | |
11 | } |