mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-11 15:10:48 +02:00
dc60d6b630
GitOrigin-RevId: 00f46c637a7563443e903f491ec39446dc570b5f
14 lines
428 B
CoffeeScript
14 lines
428 B
CoffeeScript
EMAIL_REGEXP = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\ ".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA -Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
|
|
module.exports = EmailHelper =
|
|
|
|
parseEmail: (email) ->
|
|
return null unless email?
|
|
return null if email.length > 254
|
|
email = email.trim().toLowerCase()
|
|
|
|
matched = email.match EMAIL_REGEXP
|
|
return null unless matched? && matched[0]?
|
|
|
|
matched[0]
|