Skip to content

Commit 73475f3

Browse files
authored
Merge pull request #501 from matthieusieben/remove-js-deps
Remove all runtime Javascript dependencies
2 parents 812b8d8 + 169e332 commit 73475f3

File tree

4 files changed

+87
-76
lines changed

4 files changed

+87
-76
lines changed

package-lock.json

Lines changed: 52 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,15 @@
147147
},
148148
"author": "Francois-Guillaume Ribreau <[email protected]> (http://fgribreau.com)",
149149
"license": "MIT",
150-
"dependencies": {
150+
"dependencies": {},
151+
"devDependencies": {
151152
"async": "^3.1.0",
152153
"eventemitter2": "^6.0.0",
154+
"github-changes": "^2.0.3",
153155
"glob": "^7.0.3",
154156
"lodash": "^4.17.15",
155-
"mu2": "~0.5.20",
156-
"node-range": "0.1.x"
157-
},
158-
"devDependencies": {
159-
"github-changes": "^2.0.3",
160157
"mocha": "^7.0.0",
158+
"mu2": "~0.5.20",
161159
"nodeunit": "^0.11.3",
162160
"npm-release": "^1.0.0",
163161
"npm-run-all": "^4.1.5",

platform/node/index.js

Lines changed: 18 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

platform/node/index.tmpl.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,24 @@
77
*/
88
'use strict';
99

10-
var range = require('node-range');
11-
1210
var blacklist = new Set([{{& listSTR }}]);
1311
var isValidEmail = /^{{& unanchoredRegexpString }}$/;
1412

15-
function allDomainSuffixes(email) {
16-
var domainComponents = email.split('@')[1].split('.');
17-
18-
return range(0, domainComponents.length).map(function (n) {
19-
return domainComponents.slice(n).join('.');
20-
});
21-
}
22-
2313
function isBlacklisted(email) {
24-
function suffixIsBlacklisted(domainSuffix) {
25-
return blacklist.has(domainSuffix);
26-
}
14+
var currentDomain = email.split("@")[1];
15+
var nextDot;
2716

28-
return allDomainSuffixes(email).some(suffixIsBlacklisted);
29-
};
17+
do {
18+
if (blacklist.has(currentDomain)) {
19+
return true;
20+
}
21+
} while (
22+
(nextDot = currentDomain.indexOf(".")) !== -1 &&
23+
(currentDomain = currentDomain.slice(nextDot + 1))
24+
);
25+
26+
return false;
27+
}
3028

3129
module.exports = {
3230
isValid: function (email){

0 commit comments

Comments
 (0)