tldts 7.3.0 → 7.4.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.
@@ -3,5 +3,6 @@ export declare function parse(url: string, options?: Partial<IOptions>): IResult
3
3
  export declare function getHostname(url: string, options?: Partial<IOptions>): string | null;
4
4
  export declare function getPublicSuffix(url: string, options?: Partial<IOptions>): string | null;
5
5
  export declare function getDomain(url: string, options?: Partial<IOptions>): string | null;
6
+ export declare function getFullDomain(url: string, options?: Partial<IOptions>): string | null;
6
7
  export declare function getSubdomain(url: string, options?: Partial<IOptions>): string | null;
7
8
  export declare function getDomainWithoutSuffix(url: string, options?: Partial<IOptions>): string | null;
package/index.ts CHANGED
@@ -43,6 +43,18 @@ export function getDomain(
43
43
  return parseImpl(url, FLAG.DOMAIN, suffixLookup, options, RESULT).domain;
44
44
  }
45
45
 
46
+ export function getFullDomain(
47
+ url: string,
48
+ options?: Partial<IOptions>,
49
+ ): string | null {
50
+ /*@__INLINE__*/ resetResult(RESULT);
51
+ const result = parseImpl(url, FLAG.DOMAIN, suffixLookup, options, RESULT);
52
+ // The hostname *is* the full domain (subdomain + domain) whenever a
53
+ // registrable domain exists; gate on `domain` so non-registrable inputs
54
+ // (IPs, suffix-less or invalid hostnames) return `null` like `getDomain`.
55
+ return result.domain === null ? null : result.hostname;
56
+ }
57
+
46
58
  export function getSubdomain(
47
59
  url: string,
48
60
  options?: Partial<IOptions>,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tldts",
3
- "version": "7.3.0",
3
+ "version": "7.4.0",
4
4
  "description": "Library to work against complex domain names, subdomains and URIs.",
5
5
  "author": {
6
6
  "name": "Rémi Berson"
@@ -64,11 +64,11 @@
64
64
  "rimraf": "^6.1.2",
65
65
  "rollup": "^4.57.1",
66
66
  "rollup-plugin-sourcemaps2": "^0.5.4",
67
- "tldts-tests": "^7.3.0",
67
+ "tldts-tests": "^7.4.0",
68
68
  "typescript": "^5.9.3"
69
69
  },
70
70
  "dependencies": {
71
- "tldts-core": "^7.3.0"
71
+ "tldts-core": "^7.4.0"
72
72
  },
73
73
  "keywords": [
74
74
  "tld",
@@ -85,5 +85,5 @@
85
85
  "url parsing",
86
86
  "typescript"
87
87
  ],
88
- "gitHead": "dd9b9303abe3f72eb016af337ae5cd2d818611f9"
88
+ "gitHead": "7ff853aa1c08d904fa633530b45310c49f706dc3"
89
89
  }