Socket
Socket
Sign inDemoInstall

deep-email-validator

Package Overview
Dependencies
492
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.18 to 0.1.19

2

dist/index.js

@@ -31,3 +31,3 @@ "use strict";

if (options.validateTypo) {
const typoResponse = yield typo_1.checkTypo(email);
const typoResponse = yield typo_1.checkTypo(email, options.additionalTopLevelDomains);
if (typoResponse)

@@ -34,0 +34,0 @@ return output_1.createOutput('typo', typoResponse);

@@ -9,9 +9,12 @@ declare type Options = {

};
declare type MailCheckOptions = {
additionalTopLevelDomains?: string[];
};
export declare type ValidatorOptions = Partial<Options> & {
email: string;
};
} & MailCheckOptions;
declare type ValidatorOptionsFinal = Options & {
email: string;
};
} & MailCheckOptions;
export declare function getOptions(emailOrOptions: string | ValidatorOptions): ValidatorOptionsFinal;
export {};

@@ -27,2 +27,3 @@ "use strict";

return new Promise(r => {
let receivedData = false;
const socket = net_1.default.createConnection(25, exchange);

@@ -35,12 +36,21 @@ socket.setEncoding('ascii');

});
socket.on('fail', msg => {
socket.on('close', hadError => {
if (!receivedData && !hadError) {
socket.emit('fail', 'Mail server closed connection without sending any data.');
}
});
socket.once('fail', msg => {
r(output_1.createOutput('smtp', msg));
socket.write(`quit\r\n`);
socket.end();
socket.destroy();
if (socket.writable && !socket.destroyed) {
socket.write(`quit\r\n`);
socket.end();
socket.destroy();
}
});
socket.on('success', () => {
socket.write(`quit\r\n`);
socket.end();
socket.destroy();
if (socket.writable && !socket.destroyed) {
socket.write(`quit\r\n`);
socket.end();
socket.destroy();
}
r(output_1.createOutput());

@@ -56,3 +66,8 @@ });

if (i < 3) {
socket.write(commands[i++]);
if (socket.writable) {
socket.write(commands[i++]);
}
else {
socket.emit('fail', 'SMTP communication unexpectedly closed.');
}
}

@@ -68,2 +83,3 @@ else {

socket.on('data', msg => {
receivedData = true;
log('data', msg);

@@ -70,0 +86,0 @@ if (errorCodes_1.hasCode(msg, 220) || errorCodes_1.hasCode(msg, 250)) {

@@ -1,1 +0,1 @@

export declare const checkTypo: (email: string) => Promise<string | undefined>;
export declare const checkTypo: (email: string, additionalTLDs?: string[] | undefined) => Promise<string | undefined>;

@@ -17,13 +17,20 @@ "use strict";

const mailcheck_1 = __importDefault(require("mailcheck"));
exports.checkTypo = (email) => __awaiter(void 0, void 0, void 0, function* () {
return new Promise(r => mailcheck_1.default.run({
email,
suggested: (suggestion) => {
r(`Likely typo, suggested email: ${suggestion.full}`);
},
empty: function () {
r();
},
}));
exports.checkTypo = (email, additionalTLDs) => __awaiter(void 0, void 0, void 0, function* () {
return new Promise(r => {
let topLevelDomains = undefined;
if (additionalTLDs && additionalTLDs.length > 0) {
topLevelDomains = [...mailcheck_1.default.defaultTopLevelDomains, ...additionalTLDs];
}
mailcheck_1.default.run({
email,
topLevelDomains: topLevelDomains,
suggested: (suggestion) => {
r(`Likely typo, suggested email: ${suggestion.full}`);
},
empty: function () {
r();
},
});
});
});
//# sourceMappingURL=typo.js.map
{
"name": "deep-email-validator",
"version": "0.1.18",
"version": "0.1.19",
"files": [

@@ -43,3 +43,3 @@ "dist/**/*"

"@types/disposable-email-domains": "^1.0.1",
"axios": "^0.19.2",
"axios": "^0.21.1",
"disposable-email-domains": "^1.0.53",

@@ -46,0 +46,0 @@ "lodash": "^4.17.15",

@@ -5,3 +5,3 @@ # Email Validator

Validates emails based on regex, common typos, disposable email blacklists, DNS records and SMTP server response.
Validates email addresses based on regex, common typos, disposable email blacklists, DNS records and SMTP server response.

@@ -16,8 +16,12 @@ - Validates email looks like an email i.e. contains an "@" and a "." to the right of it.

## Getting Started
Comaptible with nodejs only. Not browser ready.
Install like so
```
npm i add deep-email-validator --save
npm i deep-email-validator --save
```

@@ -60,3 +64,3 @@

// Can also be called with these options
// Can also be called with these default options
await validate({

@@ -73,1 +77,3 @@ email: 'name@example.org',

```
[Default options can be found here](https://github.com/mfbx9da4/deep-email-validator/blob/cefb37abc6e42d3a1551d38f9706d4ff538226e5/src/options/options.ts#L1)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc