tldts-core
Advanced tools
Comparing version 5.3.2 to 5.4.0
@@ -80,2 +80,14 @@ 'use strict'; | ||
/** | ||
* Return the part of domain without suffix. | ||
* | ||
* Example: for domain 'foo.com', the result would be 'foo'. | ||
*/ | ||
function getDomainWithoutSuffix(domain, suffix) { | ||
// Note: here `domain` and `suffix` cannot have the same length because in | ||
// this case we set `domain` to `null` instead. It is thus safe to assume | ||
// that `suffix` is shorter than `domain`. | ||
return domain.slice(0, -suffix.length - 1); | ||
} | ||
/** | ||
* @param url - URL we want to extract a hostname from. | ||
@@ -376,2 +388,3 @@ * @param urlIsValidHostname - hint from caller; true if `url` is already a valid hostname. | ||
domain: null, | ||
domainWithoutSuffix: null, | ||
hostname: null, | ||
@@ -439,2 +452,7 @@ isIcann: null, | ||
result.subdomain = getSubdomain(result.hostname, result.domain); | ||
if (step === 4 /* SUB_DOMAIN */) { | ||
return result; | ||
} | ||
// Extract domain without suffix | ||
result.domainWithoutSuffix = getDomainWithoutSuffix(result.domain, result.publicSuffix); | ||
return result; | ||
@@ -441,0 +459,0 @@ } |
@@ -7,2 +7,3 @@ /** | ||
import getDomain from './domain'; | ||
import getDomainWithoutSuffix from './domain-without-suffix'; | ||
import extractHostname from './extract-hostname'; | ||
@@ -17,2 +18,3 @@ import isIp from './is-ip'; | ||
domain: null, | ||
domainWithoutSuffix: null, | ||
hostname: null, | ||
@@ -80,4 +82,9 @@ isIcann: null, | ||
result.subdomain = getSubdomain(result.hostname, result.domain); | ||
if (step === 4 /* SUB_DOMAIN */) { | ||
return result; | ||
} | ||
// Extract domain without suffix | ||
result.domainWithoutSuffix = getDomainWithoutSuffix(result.domain, result.publicSuffix); | ||
return result; | ||
} | ||
//# sourceMappingURL=factory.js.map |
@@ -14,2 +14,3 @@ /** | ||
publicSuffix: string | null; | ||
domainWithoutSuffix: string | null; | ||
isIcann: boolean | null; | ||
@@ -16,0 +17,0 @@ isPrivate: boolean | null; |
{ | ||
"name": "tldts-core", | ||
"version": "5.3.2", | ||
"version": "5.4.0", | ||
"description": "tldts core primitives (internal module)", | ||
"author": "Rémi Berson", | ||
"author": { | ||
"name": "Rémi Berson" | ||
}, | ||
"contributors": [ | ||
@@ -24,2 +26,5 @@ "Alexei <alexeiatyahoodotcom@gmail.com>", | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"license": "MIT", | ||
@@ -32,3 +37,3 @@ "homepage": "https://github.com/remusao/tldts#readme", | ||
"type": "git", | ||
"url": "git@github.com:remusao/tldts.git" | ||
"url": "git+ssh://git@github.com/remusao/tldts.git" | ||
}, | ||
@@ -54,3 +59,3 @@ "main": "dist/cjs/index.js", | ||
"jest": "^24.8.0", | ||
"rimraf": "^2.6.3", | ||
"rimraf": "^3.0.0", | ||
"rollup": "^1.17.0", | ||
@@ -64,3 +69,3 @@ "rollup-plugin-node-resolve": "^5.2.0", | ||
}, | ||
"gitHead": "29ad399169551d4c2a8eb366d7d73354b1b17a3e" | ||
"gitHead": "84504d72570559f42ebf23647437b5ea0ff53d73" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
39
1138
0
181091