Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@ function isDisposable(email) {
return disposable.indexOf(domain) !== -1;
}

// Return a copy of the full list domains serving free email accounts, including disposable email accounts
function freeList() {
return free.slice();
}

// Return a copy of the full list of domains serving disposable email accounts
function disposableList() {
return disposable.slice();
}

module.exports = {
isFree: isFree,
isDisposable: isDisposable
isDisposable: isDisposable,
freeList: freeList,
disposableList: disposableList
};
30 changes: 30 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,33 @@ test('gmail.com should not be disposable', function(t) {
t.plan(1);
t.equal(freemail.isDisposable('smith@gmail.com'), false);
});

test('freeList() should return an array', function(t) {
t.plan(1);
t.equal(Array.isArray(freemail.freeList()), true);
});

test('freeList() should return an array containing gmail.com', function(t) {
t.plan(1);
t.notEqual(freemail.freeList().indexOf('gmail.com'), -1);
});

test('freeList() should return an array containing mailinater.com', function(t) {
t.plan(1);
t.notEqual(freemail.freeList().indexOf('mailinater.com'), -1);
});

test('disposableList() should return an array', function(t) {
t.plan(1);
t.equal(Array.isArray(freemail.disposableList()), true);
});

test('disposableList() should return an array containing mailinater.com', function(t) {
t.plan(1);
t.notEqual(freemail.disposableList().indexOf('mailinater.com'), -1);
});

test('disposableList() should return an array not containing gmail.com', function(t) {
t.plan(1);
t.equal(freemail.disposableList().indexOf('gmail.com'), -1);
});