{"action":"created","issue":{"url":"https://api.github.com/repos/caolan/forms/issues/203","repository_url":"https://api.github.com/repos/caolan/forms","labels_url":"https://api.github.com/repos/caolan/forms/issues/203/labels{/name}","comments_url":"https://api.github.com/repos/caolan/forms/issues/203/comments","events_url":"https://api.github.com/repos/caolan/forms/issues/203/events","html_url":"https://github.com/caolan/forms/issues/203","id":240750577,"number":203,"title":"Use WHATWG URL for url and email validation","user":{"login":"stevenvachon","id":170197,"avatar_url":"https://avatars3.githubusercontent.com/u/170197?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenvachon","html_url":"https://github.com/stevenvachon","followers_url":"https://api.github.com/users/stevenvachon/followers","following_url":"https://api.github.com/users/stevenvachon/following{/other_user}","gists_url":"https://api.github.com/users/stevenvachon/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenvachon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenvachon/subscriptions","organizations_url":"https://api.github.com/users/stevenvachon/orgs","repos_url":"https://api.github.com/users/stevenvachon/repos","events_url":"https://api.github.com/users/stevenvachon/events{/privacy}","received_events_url":"https://api.github.com/users/stevenvachon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-07-05T19:23:13Z","updated_at":"2017-07-05T19:52:38Z","closed_at":null,"body":"Via [universal-url](https://npmjs.com/universal-url) as it covers far more edge cases such as IDNAs and IPv6 than a simple regex will.\r\n\r\n```js\r\nconst isEmail = email => {\r\n  try {\r\n    const url = new URL(`mailto:${email}`);\r\n    return url.search === '';\r\n  } catch (error) {\r\n    return false;\r\n  }\r\n};\r\n\r\nconst isURL = url => {\r\n  try {\r\n    url = new URL(url);\r\n    return url.protocol === 'http' || url.protocol === 'https' || url.protocol === 'ftp';\r\n  } catch (error) {\r\n    return false;\r\n  }\r\n};\r\n```"},"comment":{"url":"https://api.github.com/repos/caolan/forms/issues/comments/313208374","html_url":"https://github.com/caolan/forms/issues/203#issuecomment-313208374","issue_url":"https://api.github.com/repos/caolan/forms/issues/203","id":313208374,"user":{"login":"stevenvachon","id":170197,"avatar_url":"https://avatars3.githubusercontent.com/u/170197?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenvachon","html_url":"https://github.com/stevenvachon","followers_url":"https://api.github.com/users/stevenvachon/followers","following_url":"https://api.github.com/users/stevenvachon/following{/other_user}","gists_url":"https://api.github.com/users/stevenvachon/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenvachon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenvachon/subscriptions","organizations_url":"https://api.github.com/users/stevenvachon/orgs","repos_url":"https://api.github.com/users/stevenvachon/repos","events_url":"https://api.github.com/users/stevenvachon/events{/privacy}","received_events_url":"https://api.github.com/users/stevenvachon/received_events","type":"User","site_admin":false},"created_at":"2017-07-05T19:52:38Z","updated_at":"2017-07-05T19:52:38Z","body":"Checking an email address for an IDNA is no less useful than checking a URL for the same. Email servers adhere to the same IP and DNS rules as a web server."}}
{"actor":{"display_login":"stevenvachon"}}