{"id":28236941,"url":"https://github.com/bytebodger/looks-like-email","last_synced_at":"2025-06-10T15:31:00.364Z","repository":{"id":57167238,"uuid":"341933903","full_name":"bytebodger/looks-like-email","owner":"bytebodger","description":"Utility function that determines whether a string looks like a valid email address","archived":false,"fork":false,"pushed_at":"2021-03-19T03:22:52.000Z","size":100,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-19T00:17:26.719Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytebodger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-24T14:52:37.000Z","updated_at":"2021-03-19T03:22:54.000Z","dependencies_parsed_at":"2022-08-30T13:20:26.768Z","dependency_job_id":null,"html_url":"https://github.com/bytebodger/looks-like-email","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebodger%2Flooks-like-email","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebodger%2Flooks-like-email/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebodger%2Flooks-like-email/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebodger%2Flooks-like-email/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytebodger","download_url":"https://codeload.github.com/bytebodger/looks-like-email/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebodger%2Flooks-like-email/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259101159,"owners_count":22805217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-19T00:17:06.507Z","updated_at":"2025-06-10T15:31:00.322Z","avatar_url":"https://github.com/bytebodger.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# looks-like-email\n`looks-like-email` is a utility function that determines whether a string _looks_ like a valid email address.  Obviously, this function cannot tell whether a string represents a _working_ email address.  But this utility performs a series of checks to ensure that the input at least _appears_ to be a valid email address.\n\n## Usage\n\nAfter installation, import the package:\n\n```javascript\nimport { looksLikeEmail } from '@toolz/looks-like-email';\n```\n\n### looksLikeEmail()\n\nGiven any string, `looksLikeEmail()` performs the following validates that:\n\n1. The string contains exact one `@` symbol.\n1. The `@` symbol does not appear the beginning or end of the string.  (The portion _before_ the `@` symbol is the \"local part\".  The portion _after_ it is the \"domain part\").\n1. The local part consists of alphanumerics and/or the following characters: ! # $ % \u0026 ‘ * + - / = ? ^ _ ` . { | } ~\n1. There are no consecutive periods in the local part.\n1. The domain part is no longer than 255 characters.\n1. There is _some kind of_ top-level domain in the domain part.  (Given the every fluctuating directory of TLDs, this utility does _not_ try to validate that the supplied TLD is a _real_ TLD.)\n1. The domain part is divided into _domain labels_ by periods - and there are at least two domain labels.\n1. No domain label exceeds 63 characters in length.\n1. Each domain label consists of alphanumerics and/or a hyphen.\n1. Domain labels do not start or end with a hyphen.\n\nThis utility uses `@toolz/string-contains` to look for alphanumerics _across the UTF-8 spectrum_. This means that letters are accepted when they are outside the ASCII range.\n\n```javascript\nconst API = {\n   arguments: {\n      string: {\n         required,\n         format: string,\n      },\n      showWarnings: {\n         optional,\n         format: Boolean,\n         defaultValue: false,\n      },\n   },\n   returns: Boolean,\n}\n```\n\n**Examples:**\n\n```javascript\nlooksLikeEmail('adam@bytebodger@foo.com'); // FALSE\nlooksLikeEmail('@adambytebodger.com'); // FALSE\nlooksLikeEmail('abcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzy@bytebodger.com'); // FALSE\nlooksLikeEmail('adambytebodger.com@'); // FALSE\nlooksLikeEmail('ad[am@bytebodger.com'); // FALSE\nlooksLikeEmail('ad..am@bytebodger.com'); // FALSE\nlooksLikeEmail('abc@defghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzydefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzyabcdefghijklmnopqrstuvwxzybytebodger.com'); // FALSE\nlooksLikeEmail('adam@bytebodgercom'); // FALSE\nlooksLikeEmail('adam@bytebodgerbytebodgercombytebodgercombytebodgercombytebodgercombytebodgercombytebodgercombytebodgercom.com'); // FALSE\nlooksLikeEmail('adam@byte*bodger.com'); // FALSE\nlooksLikeEmail('adam@byte.-bodger.com'); // FALSE\nlooksLikeEmail('adam@byte-.bodger.com'); // FALSE\nlooksLikeEmail('adam@byte-.bodger.com', true); // FALSE (with console warning about the error)\nlooksLikeEmail('adam@byte.bodger.com'); // TRUE\nlooksLikeEmail('adam_davis1@byte.bodger.com'); TRUE\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytebodger%2Flooks-like-email","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytebodger%2Flooks-like-email","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytebodger%2Flooks-like-email/lists"}