Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@dintero/email-chk

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dintero/email-chk

Check if an email address contains a typo and suggest the correct one.

Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
389
75.23%
Maintainers
4
Weekly downloads
 
Created
Source

email-chk

Check if an email address contains a typo and suggest the correct one.

Usage

Conventional Typescript:

import { EmailChk } from '@dintero/email-chk';

const emailChk = EmailChk({
    domains: ['gmail.com', 'hotmail.com', 'yahoo.com'],
    levensteinThreshold: 3,
});

const email = "username@gmain.com";
const result = emailChk(email); // username@gmail.com

React:

...
import { EmailChk } from '@dintero/email-chk';

const App = () => {
    const [email, setEmail] = useState('');
    const [suggestion, setSuggestion] = useState('');

    const emailChk = EmailChk({
        domains: ['gmail.com', 'hotmail.com', 'yahoo.com'],
        levensteinThreshold: 3,
    });

    const handleChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
        const { value } = e.target;
        setEmail(value);
        setSuggestion(emailChk(value)); // username@gmail.com
    }, [email]);

    return (
        <div>
            <input type="text" value={email} onChange={handleChange} />
            {suggestion && <p>Did you mean {suggestion}?</p>}
        </div>
    );
};

FAQs

Package last updated on 19 Jul 2023

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