import { IURLExtended } from './types'; import URLSearchParams from './url-search-params'; /** * A Fast implementation of url parsing, mostly API-compatible with the standard URL class while * being on average 2-3 times faster. Evaluation of URL components is lazy, so this implementation * should be fast for all use-cases. * * Known differences to standard URL: * * Parameters returned via `URL.searchParams.entries()` are decoded only with * `decodeURIComponent`. This differs to standards parsing in some subtle ways. * * You can iterate a URL parameters array directly via `URL.searchParams.params`. This is around * 20% faster than using an iterator. * * Parameter strings are parsed, and accessible via `URL.parameters`. * * Domain parsing with tldts is built in. The `URL.domainInfo` attribute returns output from tldts' * `parseHost` method. * * Hostname validation is not done on initial parse. The `isValidHost()` method is provided for * this purpose. * * Some extra helper methods. * * See also for common API: https://developer.mozilla.org/en-US/docs/Web/API/URL */ export default class implements IURLExtended { origin: string; slashes: string; private _protocol; private _username; private _password; private _hostname; private _host; private _port; private _pathname; private _search; private _hash; private _href; private parameterStartIndex; private queryStartIndex; private isQueryParsed; private _parameters; private _query; private _domainInfo; private parsedParameters; constructor(url: string); get protocol(): string; get username(): string; get password(): string; get hostname(): string; get host(): string; get port(): string; get pathname(): string; /** * The query string component of the URL, including the preceding `?` character. * See also: https://developer.mozilla.org/en-US/docs/Web/API/URL/search */ get search(): string; /** * Parsed query string parameters, as a `URLSearchParams` object. * See also: https://developer.mozilla.org/en-US/docs/Web/API/URL/searchParams */ get searchParams(): URLSearchParams; /** * Parsed parameter string from the url. These are `;` separated key/values appearing in the URL * path, before the query string. */ get parameters(): URLSearchParams; /** * Check if the URL has a parameter string * @returns true iff `;` occurs in the URL path before a `?`. */ hasParameterString(): boolean; /** * URL hash or fragment component. * See also: https://developer.mozilla.org/en-US/docs/Web/API/URL/hash */ get hash(): string; get href(): string; /** * Returns the url (post parsing). * See also: https://developer.mozilla.org/en-US/docs/Web/API/URL/toString */ toString(): string; /** * JSONified URL (== toString) * See also: https://developer.mozilla.org/en-US/docs/Web/API/URL/toJSON */ toJSON(): string; /** * Get parsed domainInfo from the hostname. * @returns parsed domain, from tldts `parse` method. */ get domainInfo(): import("tldts-core").IResult; /** * Returns true iff the hostname of this url is an IP address. False otherwise. */ get hostIsIp(): boolean | null; /** * Returns the hostname of the URL after parsing by tldts. This includes some error correction. */ get domain(): string; /** * Get eTLD+1 of the hostname. */ get generalDomain(): string; /** * Legacy attribute for `pathname`. */ get path(): string; /** * Scheme = protocol without a trailing ':'. */ get scheme(): string; /** * Check if the hostname of the URL is valid, i.e. * * it is an IP address, or * * it is a valid hostname with a known public suffix. * @returns true if host is valid, otherwise false. */ isValidHost(): boolean; /** * Non-standard params extractor. * * Returns search params from parameter string and query params with more aggessive extraction * than the standard URL implementation. Extra extraction features are: * * `;` separated parameters - used by multi trackers * @returns URLSearchParams */ extractKeyValues(): URLSearchParams; private _extractHostname; private _extractParams; private _extractSearchParams; private _extractParamTuples; private parse; }