mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 12:20:04 +02:00
update node modules
This commit is contained in:
30
node_modules/tough-cookie/lib/permuteDomain.js
generated
vendored
30
node_modules/tough-cookie/lib/permuteDomain.js
generated
vendored
@@ -29,12 +29,26 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
"use strict";
|
||||
var pubsuffix = require('./pubsuffix-psl');
|
||||
const pubsuffix = require("./pubsuffix-psl");
|
||||
|
||||
// Gives the permutation of all possible domainMatch()es of a given domain. The
|
||||
// array is in shortest-to-longest order. Handy for indexing.
|
||||
function permuteDomain (domain) {
|
||||
var pubSuf = pubsuffix.getPublicSuffix(domain);
|
||||
const SPECIAL_USE_DOMAINS = ["local"]; // RFC 6761
|
||||
function permuteDomain(domain, allowSpecialUseDomain) {
|
||||
let pubSuf = null;
|
||||
if (allowSpecialUseDomain) {
|
||||
const domainParts = domain.split(".");
|
||||
if (SPECIAL_USE_DOMAINS.includes(domainParts[domainParts.length - 1])) {
|
||||
pubSuf = `${domainParts[domainParts.length - 2]}.${
|
||||
domainParts[domainParts.length - 1]
|
||||
}`;
|
||||
} else {
|
||||
pubSuf = pubsuffix.getPublicSuffix(domain);
|
||||
}
|
||||
} else {
|
||||
pubSuf = pubsuffix.getPublicSuffix(domain);
|
||||
}
|
||||
|
||||
if (!pubSuf) {
|
||||
return null;
|
||||
}
|
||||
@@ -42,12 +56,12 @@ function permuteDomain (domain) {
|
||||
return [domain];
|
||||
}
|
||||
|
||||
var prefix = domain.slice(0, -(pubSuf.length + 1)); // ".example.com"
|
||||
var parts = prefix.split('.').reverse();
|
||||
var cur = pubSuf;
|
||||
var permutations = [cur];
|
||||
const prefix = domain.slice(0, -(pubSuf.length + 1)); // ".example.com"
|
||||
const parts = prefix.split(".").reverse();
|
||||
let cur = pubSuf;
|
||||
const permutations = [cur];
|
||||
while (parts.length) {
|
||||
cur = parts.shift() + '.' + cur;
|
||||
cur = `${parts.shift()}.${cur}`;
|
||||
permutations.push(cur);
|
||||
}
|
||||
return permutations;
|
||||
|
Reference in New Issue
Block a user