Skip to content

Commit

Permalink
doc: add added: information for punycode
Browse files Browse the repository at this point in the history
PR-URL: #6805
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
firedfox authored and Myles Borins committed Jul 12, 2016
1 parent d2c090f commit 52f1012
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion doc/api/punycode.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

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
`punycode` module first.)

## punycode.decode(string)
<!-- YAML
added: v0.5.1
-->

Converts a Punycode string of ASCII-only symbols to a string of Unicode symbols.

Expand All @@ -17,6 +20,9 @@ punycode.decode('--dqo34k'); // 'β˜ƒ-⌘'
```

## punycode.encode(string)
<!-- YAML
added: v0.5.1
-->

Converts a string of Unicode symbols to a Punycode string of ASCII-only symbols.

Expand All @@ -27,6 +33,9 @@ punycode.encode('β˜ƒ-⌘'); // '--dqo34k'
```

## punycode.toASCII(domain)
<!-- YAML
added: v0.6.1
-->

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
Expand All @@ -39,6 +48,9 @@ punycode.toASCII('β˜ƒ-⌘.com'); // 'xn----dqo34k.com'
```

## punycode.toUnicode(domain)
<!-- YAML
added: v0.6.1
-->

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
Expand All @@ -51,8 +63,14 @@ punycode.toUnicode('xn----dqo34k.com'); // 'β˜ƒ-⌘.com'
```

## punycode.ucs2
<!-- YAML
added: v0.7.0
-->

### punycode.ucs2.decode(string)
<!-- YAML
added: v0.7.0
-->

Creates an array containing the numeric code point values of each Unicode
symbol in the string. While [JavaScript uses UCS-2 internally][], this function
Expand All @@ -66,6 +84,9 @@ punycode.ucs2.decode('\uD834\uDF06'); // [0x1D306]
```

### punycode.ucs2.encode(codePoints)
<!-- YAML
added: v0.7.0
-->

Creates a string based on an array of numeric code point values.

Expand All @@ -75,6 +96,9 @@ punycode.ucs2.encode([0x1D306]); // '\uD834\uDF06'
```

## punycode.version
<!-- YAML
added: v0.6.1
-->

A string representing the current Punycode.js version number.

Expand Down

0 comments on commit 52f1012

Please sign in to comment.