tldts-experimental 6.1.86 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +9 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -449,24 +449,27 @@ function parseImpl(url, step, suffixLookup, partialOptions, result) {
|
|
|
449
449
|
else {
|
|
450
450
|
result.hostname = extractHostname(url, false);
|
|
451
451
|
}
|
|
452
|
-
if (step === 0 /* FLAG.HOSTNAME */ || result.hostname === null) {
|
|
453
|
-
return result;
|
|
454
|
-
}
|
|
455
452
|
// Check if `hostname` is a valid ip address
|
|
456
|
-
if (options.detectIp) {
|
|
453
|
+
if (options.detectIp && result.hostname !== null) {
|
|
457
454
|
result.isIp = isIp(result.hostname);
|
|
458
455
|
if (result.isIp) {
|
|
459
456
|
return result;
|
|
460
457
|
}
|
|
461
458
|
}
|
|
462
|
-
// Perform
|
|
463
|
-
// go further as there will be no valid domain or sub-domain.
|
|
459
|
+
// Perform hostname validation if enabled. If hostname is not valid, no need to
|
|
460
|
+
// go further as there will be no valid domain or sub-domain. This validation
|
|
461
|
+
// is applied before any early returns to ensure consistent behavior across
|
|
462
|
+
// all API methods including getHostname().
|
|
464
463
|
if (options.validateHostname &&
|
|
465
464
|
options.extractHostname &&
|
|
465
|
+
result.hostname !== null &&
|
|
466
466
|
!isValidHostname(result.hostname)) {
|
|
467
467
|
result.hostname = null;
|
|
468
468
|
return result;
|
|
469
469
|
}
|
|
470
|
+
if (step === 0 /* FLAG.HOSTNAME */ || result.hostname === null) {
|
|
471
|
+
return result;
|
|
472
|
+
}
|
|
470
473
|
// Extract public suffix
|
|
471
474
|
suffixLookup(result.hostname, options, result);
|
|
472
475
|
if (step === 2 /* FLAG.PUBLIC_SUFFIX */ || result.publicSuffix === null) {
|