Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#169 Plain domain file with conversion to JSON #171

Merged
merged 3 commits into from
Mar 28, 2019
Merged
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

[![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/francois-guillaume-ribreau?utm_source=github&utm_medium=button&utm_term=francois-guillaume-ribreau&utm_campaign=github) [![available-for-advisory](https://img.shields.io/badge/available%20for%20advising-yes-ff69b4.svg?)](http://bit.ly/2c7uFJq) ![extra](https://img.shields.io/badge/actively%20maintained-yes-ff69b4.svg?)

Cross-language email validation. Backed by a [database](./list.json) of **5277 throwable email providers**.
Cross-language email validation. Backed by a [database](./list.txt) of **over 19000 throwable email domains**.

* Validate the format of your email (uses [validator.js](https://github.com/chriso/validator.js/blob/master/validator.js#L38) email regex underneath and `FILTER_VALIDATE_EMAIL` for PHP)
* Validate if the email is not a **temporary mail** (yopmail-like..., [add your own dataset to list.json](./list.json))
* Validate if the email is not a **temporary mail** (yopmail-like..., [add your own dataset to list.txt](./list.txt))

This will be very helpful when you have to contact your users and you want to avoid errors causing lack of communication or want to block "spamboxes".

Expand Down Expand Up @@ -223,9 +223,9 @@ __We accept pull-requests for other package manager__.
Array.prototype.slice.call(document.querySelectorAll('.entry > ul > li a')).map(function(el){return el.innerText});
```

... [please add your own dataset to list.json](./list.json).
... [please add your own dataset to list.txt](./list.txt).

Regenerate libraries from list.json
Regenerate libraries from list.txt
-------------------------------

Just run (requires NodeJS):
Expand Down
12 changes: 8 additions & 4 deletions lib/loader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var cjson = require('cjson');
var fs = require('fs');
var p = require('path');
var _ = require('lodash');

Expand All @@ -10,11 +10,15 @@ var _ = require('lodash');
*/
var loader = {
getList: function () {
return _.flowRight(_.flatten, _.uniq)(this.getLists());
var path = p.resolve(__dirname, '../list.txt');
return _.uniq(this.getDomains(path));
},

getLists: function () {
return cjson.load(p.resolve(__dirname, '../list.json'));
getDomains: function (path) {
return fs
.readFileSync(path)
.toString()
.split('\n');
}
};

Expand Down
135 changes: 0 additions & 135 deletions list.json

This file was deleted.

Loading