Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

email-amender

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

email-amender

Rectify your user email address inputs from common spelling mistakes, probably due to the new MacBook Pro keyboard.

  • 0.2.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Email Amender

Build Status npm version codecov Known Vulnerabilities

An opinionated library on how to correct fat-fingered and mis-typed email addresses from user input.

How it Works

  1. It trims and lowercases the input email address. If it's falsy, i.e. it returns null.
  2. Then it splits the email string into domain, TLD (Top Level Domain), and SLD (Second Level Domain). Note: .co.uk among other non-US TLDs would break this, which will be addressed in future versions of Email Amender.
  3. It checks to see if the TLD exists in a common list of TLDs. If so it skips to the next step. Otherwise:
    1. It first checks to the ceo the user input TLD begins with one of the common TLDs, which is a cheap check to see if extra letters happened to be added on. An example would be when a user thinks they've moved to the nexxt form field, and started typing more into the email address input field.
    2. If there is nothing found, it uses fuzzyset.js to fine the nearest probable match to one of the common TLDs.
  4. This is super primitive right now._ It checks to see if the SLD exists in a common list of SLDs. If the SLD doesn't exist in the preset list, it checks to see if there's one using fuzzyset.js, but requires an 80% probability. See the TODOs.

Development

Just run yarn, and then run yarn test to see if everything is working right.

To try to solve the failing tests, use yarn test:failing to check your work.

Credits

FAQs

Package last updated on 10 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc