top-level-domains
Version:
A comprehensive list of all existing Top-Level Domains (TLDs) that can be registered
40 lines (39 loc) • 1.13 kB
TypeScript
export interface TldEntry {
tld: string;
punycode: string;
}
/**
* The complete list of all TLDs
*/
export declare const tlds: TldEntry[];
/**
* Get all TLDs as an array of strings
* @returns Array of TLD strings (e.g., ["com", "org", "net", ...])
*/
export declare function getAllTlds(): string[];
/**
* Check if a string is a valid TLD
* @param tld The TLD to check
* @returns True if the TLD exists in the list
*/
export declare function isTld(tld: string): boolean;
/**
* Get the punycode representation of a TLD
* @param tld The TLD to get the punycode for
* @returns The punycode representation or null if the TLD doesn't exist
*/
export declare function getPunycode(tld: string): string | null;
/**
* Filter TLDs by a search string
* @param search The search string
* @returns Array of TLD entries that match the search
*/
export declare function searchTlds(search: string): TldEntry[];
declare const _default: {
tlds: TldEntry[];
getAllTlds: typeof getAllTlds;
isTld: typeof isTld;
getPunycode: typeof getPunycode;
searchTlds: typeof searchTlds;
};
export default _default;