CoolFace
Apppublic

Pinsave/counterstrike

sourceHugging Faceupdated 3mo agoView on Hugging Face
1likes
punycode.d.ts118 linesDownload Raw Back to node
1/**2 * **The version of the punycode module bundled in Node.js is being deprecated. **In a future major version of Node.js this module will be removed. Users3 * currently depending on the `punycode` module should switch to using the4 * userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL5 * encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`.6 *7 * The `punycode` module is a bundled version of the [Punycode.js](https://github.com/bestiejs/punycode.js) module. It8 * can be accessed using:9 *10 * ```js11 * import punycode from 'node:punycode';12 * ```13 *14 * [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is15 * primarily intended for use in Internationalized Domain Names. Because host16 * names in URLs are limited to ASCII characters only, Domain Names that contain17 * non-ASCII characters must be converted into ASCII using the Punycode scheme.18 * For instance, the Japanese character that translates into the English word, `'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent19 * to `'example.com'`) is represented by Punycode as the ASCII string `'xn--fsq.com'`.20 *21 * The `punycode` module provides a simple implementation of the Punycode standard.22 *23 * The `punycode` module is a third-party dependency used by Node.js and24 * made available to developers as a convenience. Fixes or other modifications to25 * the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project.26 * @deprecated Since v7.0.0 - Deprecated27 * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/punycode.js)28 */29declare module "punycode" {30    /**31     * The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only32     * characters to the equivalent string of Unicode codepoints.33     *34     * ```js35     * punycode.decode('maana-pta'); // 'mañana'36     * punycode.decode('--dqo34k'); // '☃-⌘'37     * ```38     * @since v0.5.139     */40    function decode(string: string): string;41    /**42     * The `punycode.encode()` method converts a string of Unicode codepoints to a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only characters.43     *44     * ```js45     * punycode.encode('mañana'); // 'maana-pta'46     * punycode.encode('☃-⌘'); // '--dqo34k'47     * ```48     * @since v0.5.149     */50    function encode(string: string): string;51    /**52     * The `punycode.toUnicode()` method converts a string representing a domain name53     * containing [Punycode](https://tools.ietf.org/html/rfc3492) encoded characters into Unicode. Only the [Punycode](https://tools.ietf.org/html/rfc3492) encoded parts of the domain name are be54     * converted.55     *56     * ```js57     * // decode domain names58     * punycode.toUnicode('xn--maana-pta.com'); // 'mañana.com'59     * punycode.toUnicode('xn----dqo34k.com');  // '☃-⌘.com'60     * punycode.toUnicode('example.com');       // 'example.com'61     * ```62     * @since v0.6.163     */64    function toUnicode(domain: string): string;65    /**66     * The `punycode.toASCII()` method converts a Unicode string representing an67     * Internationalized Domain Name to [Punycode](https://tools.ietf.org/html/rfc3492). Only the non-ASCII parts of the68     * domain name will be converted. Calling `punycode.toASCII()` on a string that69     * already only contains ASCII characters will have no effect.70     *71     * ```js72     * // encode domain names73     * punycode.toASCII('mañana.com');  // 'xn--maana-pta.com'74     * punycode.toASCII('☃-⌘.com');   // 'xn----dqo34k.com'75     * punycode.toASCII('example.com'); // 'example.com'76     * ```77     * @since v0.6.178     */79    function toASCII(domain: string): string;80    /**81     * @deprecated since v7.0.082     * The version of the punycode module bundled in Node.js is being deprecated.83     * In a future major version of Node.js this module will be removed.84     * Users currently depending on the punycode module should switch to using85     * the userland-provided Punycode.js module instead.86     */87    const ucs2: ucs2;88    interface ucs2 {89        /**90         * @deprecated since v7.0.091         * The version of the punycode module bundled in Node.js is being deprecated.92         * In a future major version of Node.js this module will be removed.93         * Users currently depending on the punycode module should switch to using94         * the userland-provided Punycode.js module instead.95         */96        decode(string: string): number[];97        /**98         * @deprecated since v7.0.099         * The version of the punycode module bundled in Node.js is being deprecated.100         * In a future major version of Node.js this module will be removed.101         * Users currently depending on the punycode module should switch to using102         * the userland-provided Punycode.js module instead.103         */104        encode(codePoints: readonly number[]): string;105    }106    /**107     * @deprecated since v7.0.0108     * The version of the punycode module bundled in Node.js is being deprecated.109     * In a future major version of Node.js this module will be removed.110     * Users currently depending on the punycode module should switch to using111     * the userland-provided Punycode.js module instead.112     */113    const version: string;114}115declare module "node:punycode" {116    export * from "punycode";117}118