doc: add added: information for punycode

PR-URL: https://github.com/nodejs/node/pull/6805
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Daniel Wang 2016-05-17 18:58:03 +08:00 committed by Ben Noordhuis
parent 4fe1d6e75f
commit b90c52e38d

View File

@ -2,11 +2,14 @@
Stability: 2 - Stable Stability: 2 - Stable
[Punycode.js][] is bundled with Node.js v0.6.2+. Use `require('punycode')` to [Punycode.js][] is bundled with Node.js v0.5.1+. Use `require('punycode')` to
access it. (To use it with other Node.js versions, use npm to install the access it. (To use it with other Node.js versions, use npm to install the
`punycode` module first.) `punycode` module first.)
## punycode.decode(string) ## punycode.decode(string)
<!-- YAML
added: v0.5.1
-->
Converts a Punycode string of ASCII-only symbols to a string of Unicode symbols. Converts a Punycode string of ASCII-only symbols to a string of Unicode symbols.
@ -17,6 +20,9 @@ punycode.decode('--dqo34k'); // '☃-⌘'
``` ```
## punycode.encode(string) ## punycode.encode(string)
<!-- YAML
added: v0.5.1
-->
Converts a string of Unicode symbols to a Punycode string of ASCII-only symbols. Converts a string of Unicode symbols to a Punycode string of ASCII-only symbols.
@ -27,6 +33,9 @@ punycode.encode('☃-⌘'); // '--dqo34k'
``` ```
## punycode.toASCII(domain) ## punycode.toASCII(domain)
<!-- YAML
added: v0.6.1
-->
Converts a Unicode string representing a domain name to Punycode. Only the Converts a Unicode string representing a domain name to Punycode. Only the
non-ASCII parts of the domain name will be converted, i.e. it doesn't matter if non-ASCII parts of the domain name will be converted, i.e. it doesn't matter if
@ -39,6 +48,9 @@ punycode.toASCII('☃-⌘.com'); // 'xn----dqo34k.com'
``` ```
## punycode.toUnicode(domain) ## punycode.toUnicode(domain)
<!-- YAML
added: v0.6.1
-->
Converts a Punycode string representing a domain name to Unicode. Only the Converts a Punycode string representing a domain name to Unicode. Only the
Punycoded parts of the domain name will be converted, i.e. it doesn't matter if Punycoded parts of the domain name will be converted, i.e. it doesn't matter if
@ -51,8 +63,14 @@ punycode.toUnicode('xn----dqo34k.com'); // '☃-⌘.com'
``` ```
## punycode.ucs2 ## punycode.ucs2
<!-- YAML
added: v0.7.0
-->
### punycode.ucs2.decode(string) ### punycode.ucs2.decode(string)
<!-- YAML
added: v0.7.0
-->
Creates an array containing the numeric code point values of each Unicode Creates an array containing the numeric code point values of each Unicode
symbol in the string. While [JavaScript uses UCS-2 internally][], this function symbol in the string. While [JavaScript uses UCS-2 internally][], this function
@ -66,6 +84,9 @@ punycode.ucs2.decode('\uD834\uDF06'); // [0x1D306]
``` ```
### punycode.ucs2.encode(codePoints) ### punycode.ucs2.encode(codePoints)
<!-- YAML
added: v0.7.0
-->
Creates a string based on an array of numeric code point values. Creates a string based on an array of numeric code point values.
@ -75,6 +96,9 @@ punycode.ucs2.encode([0x1D306]); // '\uD834\uDF06'
``` ```
## punycode.version ## punycode.version
<!-- YAML
added: v0.6.1
-->
A string representing the current Punycode.js version number. A string representing the current Punycode.js version number.