0% found this document useful (0 votes)
2 views

index.cjs.d

The document defines a TypeScript class 'Url' with properties for various components of a URL and methods for parsing URLs. It also declares a namespace 'mdurl' that includes functions for encoding and decoding percent-encoded strings, as well as formatting and parsing URLs. The 'mdurl' namespace provides a structured way to handle URL manipulation in TypeScript.

Uploaded by

Gustavo Avila
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

index.cjs.d

The document defines a TypeScript class 'Url' with properties for various components of a URL and methods for parsing URLs. It also declares a namespace 'mdurl' that includes functions for encoding and decoding percent-encoded strings, as well as formatting and parsing URLs. The 'mdurl' namespace provides a structured way to handle URL manipulation in TypeScript.

Uploaded by

Gustavo Avila
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

declare class Url {

protocol: string;
slashes: string;
auth: string;
port: string;
hostname: string;
hash: string;
search: string;
pathname: string;

constructor();

parse(url: string, slashesDenoteHost?: boolean): this;


parseHost(host: string): void;
}

type Url_ = Url;

declare namespace mdurl {


type Url = Url_;
}

declare const mdurl: {


decode: {
defaultChars: string;
componentChars: string;
/**
* Decode percent-encoded string.
*/
(str: string, exclude?: string): string;
};

encode: {
defaultChars: string;
componentChars: string;
/**
* Encode unsafe characters with percent-encoding, skipping already
* encoded sequences.
*
* @param str string to encode
* @param exclude list of characters to ignore (in addition to a-zA-Z0-9)
* @param keepEscaped don't encode '%' in a correct escape sequence
(default: true)
*/
(str: string, exclude?: string, keepEscaped?: boolean): string;
};

format(url: Omit<mdurl.Url, "parse" | "parseHost">): string;

parse(url: string | mdurl.Url, slashesDenoteHost?: boolean): mdurl.Url;


};

export = mdurl;

You might also like