1 line
1.6 KiB
Plaintext
1 line
1.6 KiB
Plaintext
{"version":3,"sources":["index.js"],"names":[],"mappings":";;;;;QAKgB,Q,GAAA,Q;AALhB,IAAI,SAAS,gIAAb;AACA;AACA;AACA;AACA;AACO,SAAS,QAAT,CAAkB,KAAlB,EACP;AACC,KAAI,CAAC,KAAL,EACC,OAAO,KAAP;;AAED,KAAG,MAAM,MAAN,GAAa,GAAhB,EACC,OAAO,KAAP;;AAED,KAAI,QAAQ,OAAO,IAAP,CAAY,KAAZ,CAAZ;AACA,KAAG,CAAC,KAAJ,EACC,OAAO,KAAP;;AAED;AACA,KAAI,QAAQ,MAAM,KAAN,CAAY,GAAZ,CAAZ;AACA,KAAG,MAAM,CAAN,EAAS,MAAT,GAAgB,EAAnB,EACC,OAAO,KAAP;;AAED,KAAI,cAAc,MAAM,CAAN,EAAS,KAAT,CAAe,GAAf,CAAlB;AACA,KAAG,YAAY,IAAZ,CAAiB,UAAS,IAAT,EAAe;AAAE,SAAO,KAAK,MAAL,GAAY,EAAnB;AAAwB,EAA1D,CAAH,EACC,OAAO,KAAP;;AAED,QAAO,IAAP;AACA","file":"index.cjs.js","sourcesContent":["var tester = /^[-!#$%&'*+\\/0-9=?A-Z^_a-z{|}~](\\.?[-!#$%&'*+\\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-?\\.?[a-zA-Z0-9])*\\.[a-zA-Z](-?[a-zA-Z0-9])+$/;\r\n// Thanks to:\r\n// http://fightingforalostcause.net/misc/2006/compare-email-regex.php\r\n// http://thedailywtf.com/Articles/Validating_Email_Addresses.aspx\r\n// http://stackoverflow.com/questions/201323/what-is-the-best-regular-expression-for-validating-email-addresses/201378#201378\r\nexport function validate(email)\r\n{\r\n\tif (!email)\r\n\t\treturn false;\r\n\r\n\tif(email.length>254)\r\n\t\treturn false;\r\n\r\n\tvar valid = tester.test(email);\r\n\tif(!valid)\r\n\t\treturn false;\r\n\r\n\t// Further checking of some things regex can't handle\r\n\tvar parts = email.split(\"@\");\r\n\tif(parts[0].length>64)\r\n\t\treturn false;\r\n\r\n\tvar domainParts = parts[1].split(\".\");\r\n\tif(domainParts.some(function(part) { return part.length>63; }))\r\n\t\treturn false;\r\n\r\n\treturn true;\r\n}\r\n"]} |