Comparing version 0.0.5 to 0.0.6
@@ -1,5 +0,5 @@ | ||
var legit = require('../index.js'); | ||
const legit = require('../index.js'); | ||
legit('martyn@sendgrid.com', function(validation, addresses) { | ||
if (validation === true) { | ||
legit('martyn@martyndavies.me', function(err, validation, addresses) { | ||
if (validation == true) { | ||
console.log('This is a real email that can accept emails!'); | ||
@@ -10,2 +10,2 @@ console.log(JSON.stringify(addresses)); | ||
} | ||
}); | ||
}); |
@@ -1,13 +0,13 @@ | ||
var dns = require('dns'); | ||
const dns = require('dns'); | ||
module.exports = function(emailAddress, cb) { | ||
'use strict'; | ||
var splitEmail = emailAddress.split('@'); | ||
let splitEmail = emailAddress.split('@'); | ||
dns.resolveMx(splitEmail[1], function(err, addresses){ | ||
if (addresses) { | ||
cb(true, addresses, null); | ||
cb(null, true, addresses); | ||
} else { | ||
cb(false, null, err); | ||
cb(err, false, null); | ||
} | ||
}); | ||
}; |
{ | ||
"name": "legit", | ||
"version": "0.0.5", | ||
"description": "Check that email addresses are really able to accept emails", | ||
"version": "0.0.6", | ||
"description": "Check that email addresses are really able to accept emails by pinging the DNS and checking for active MX records.", | ||
"main": "index.js", | ||
"respository": "https://github.com/martyndavies/legit", | ||
"devDependencies":{ | ||
@@ -7,0 +8,0 @@ "should": "*", |
@@ -5,4 +5,2 @@ # Legit | ||
[![Build Status](https://travis-ci.org/martyndavies/legit.png?branch=master)](https://travis-ci.org/martyndavies/legit) | ||
## Installation | ||
@@ -16,10 +14,10 @@ | ||
```javascript | ||
var checkEmail = require('legit'); | ||
const legit = require('legit'); | ||
checkEmail('martyn@sendgrid.com', function(validation, addresses, err) { | ||
if (validation) { | ||
legit('martyn@martyndavies.me', function(err, validation, addresses) { | ||
if (validation == true) { | ||
console.log('This is a real email that can accept emails!'); | ||
console.log(JSON.stringify(addresses)); | ||
} else { | ||
console.log('This domain cannot accept emails, you might want to remove it.'); | ||
console.log('Error: '+ err); | ||
} | ||
@@ -42,2 +40,2 @@ }); | ||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
@@ -1,4 +0,4 @@ | ||
var assert = require('assert'); | ||
var should = require('should'); | ||
var legit = require('../'); | ||
const assert = require('assert'); | ||
const should = require('should'); | ||
const legit = require('../'); | ||
@@ -8,3 +8,3 @@ describe('Testing Emails', function(){ | ||
it('should return true when email is legit', function(){ | ||
legit('martyn@sendgrid.com', function(validation, addresses){ | ||
legit('martyn@martyndavies.me', function(err, validation, addresses){ | ||
validation.should.be.true; | ||
@@ -18,8 +18,9 @@ should.exist(addresses); | ||
it('should return false when email is not legit', function(){ | ||
legit('nosir@neverwouldibuythisdomainladdyohno.com', function(validation, addresses){ | ||
legit('nosir@neverwouldibuythisdomainladdyohno.com', function(err, validation, addresses){ | ||
validation.should.be.false; | ||
should.not.exist(addresses); | ||
should.exist(err); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3739
43
39