@types/tldjs
TypeScript icon, indicating that this package has built-in type declarations

2.3.4 • Public • Published

Installation

npm install --save @types/tldjs

Summary

This package contains type definitions for tldjs (https://github.com/oncletom/tld.js).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/tldjs.

index.d.ts

export declare function tldExists(host: string): boolean;

export declare function getDomain(host: string): string | null;

export declare function getSubdomain(host: string): string | null;

export declare function getPublicSuffix(host: string): string | null;

/**
 * @deprecated "isValid" is deprecated, please use "isValidHostname" instead.
 */
export declare function isValid(host: string): boolean;

export declare function isValidHostname(host: string): boolean;

export declare function extractHostname(host: string): string | null;

export declare function parse(host: string): {
    hostname: ReturnType<typeof extractHostname>;
    isValid: ReturnType<typeof isValid>;
    isIp: boolean;
    tldExists: ReturnType<typeof tldExists>;
    publicSuffix: ReturnType<typeof getPublicSuffix>;
    domain: ReturnType<typeof getDomain>;
    subdomain: ReturnType<typeof getSubdomain>;
};

export declare function fromUserSettings(options: {
    rules?: any;
    validHosts?: string[] | undefined;
    extractHostname?: ReturnType<typeof extractHostname> | undefined;
}): {
    extractHostname: typeof extractHostname;
    isValidHostname: typeof isValidHostname;
    isValid: typeof isValid;
    parse: typeof parse;
    tldExists: typeof tldExists;
    getPublicSuffix: typeof getPublicSuffix;
    getDomain: typeof getDomain;
    getSubdomain: typeof getSubdomain;
    fromUserSettings: typeof fromUserSettings;
};

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: none

Credits

These definitions were written by Joshua DeVinney.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/tldjs

Weekly Downloads

21,261

Version

2.3.4

License

MIT

Unpacked Size

5.35 kB

Total Files

5

Last publish

Collaborators

  • types