-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
20 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
import type * as tldts from 'tldts'; | ||
|
||
export const looseTldtsOpt: Parameters<typeof tldts.getSubdomain>[1] = { | ||
export const looseTldtsOpt: NonNullable<Parameters<typeof tldts.getSubdomain>[1]> = { | ||
allowPrivateDomains: false, | ||
extractHostname: false, | ||
validateHostname: false, | ||
detectIp: false, | ||
mixedInputs: false | ||
}; | ||
|
||
export const loosTldOptWithPrivateDomains: Parameters<typeof tldts.getSubdomain>[1] = { | ||
export const loosTldOptWithPrivateDomains: NonNullable<Parameters<typeof tldts.getSubdomain>[1]> = { | ||
...looseTldtsOpt, | ||
allowPrivateDomains: true | ||
}; | ||
|
||
export const normalizeTldtsOpt: Parameters<typeof tldts.getSubdomain>[1] = { | ||
export const normalizeTldtsOpt: NonNullable<Parameters<typeof tldts.getSubdomain>[1]> = { | ||
allowPrivateDomains: true, | ||
detectIp: true | ||
// in normalizeDomain, we only care if it contains IP, we don't care if we need to extract it | ||
// by setting detectIp to false and manually check ip outside tldts.parse, we can skip the tldts | ||
// inner "extractHostname" call | ||
detectIp: false | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters