commit
0e07e42383
4
index.js
4
index.js
@ -6,9 +6,7 @@ var free = fs.readFileSync(__dirname + '/data/free.txt').toString().split('\n').
|
||||
|
||||
function isFree(email) {
|
||||
if (typeof email !== 'string') throw new TypeError('email must be a string');
|
||||
console.log(email);
|
||||
var domain = tldjs.getDomain(email.split('@').pop());
|
||||
console.log(domain, free.indexOf(domain));
|
||||
return free.indexOf(domain) !== -1;
|
||||
}
|
||||
|
||||
@ -20,5 +18,5 @@ function isDisposable(email) {
|
||||
|
||||
module.exports = {
|
||||
isFree: isFree,
|
||||
isDisposible: isDisposable
|
||||
isDisposable: isDisposable
|
||||
};
|
||||
|
@ -21,12 +21,12 @@ test('mailinater.com should be free', function(t) {
|
||||
t.equal(freemail.isFree('smith@mailinater.com'), true);
|
||||
});
|
||||
|
||||
test('mailinater.com should be disposible', function(t) {
|
||||
test('mailinater.com should be disposable', function(t) {
|
||||
t.plan(1);
|
||||
t.equal(freemail.isDisposible('smith@mailinater.com'), true);
|
||||
t.equal(freemail.isDisposable('smith@mailinater.com'), true);
|
||||
});
|
||||
|
||||
test('gmail.com should not be disposible', function(t) {
|
||||
test('gmail.com should not be disposable', function(t) {
|
||||
t.plan(1);
|
||||
t.equal(freemail.isDisposible('smith@gmail.com'), false);
|
||||
t.equal(freemail.isDisposable('smith@gmail.com'), false);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user