Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Document the fact that toASCII expects normalized input
Ref. #26.
  • Loading branch information
mathiasbynens committed Jan 20, 2015
1 parent 30f8154 commit e1d4f59
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -10,11 +10,11 @@ This JavaScript library is the result of comparing, optimizing and documenting d
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))

This project is [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with [Node.js v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc).
This project is [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with [Node.js v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) and [io.js v1.0.0+](https://github.com/iojs/io.js/blob/v1.x/lib/punycode.js).

## Installation

Via [npm](http://npmjs.org/) (only required for Node.js releases older than v0.6.2):
Via [npm](https://www.npmjs.org/) (only required for Node.js releases older than v0.6.2):

This comment has been minimized.

Copy link
@bnjmnt4n

bnjmnt4n Jan 20, 2015

Contributor

It’s now .com. 😃

This comment has been minimized.

Copy link
@mathiasbynens

mathiasbynens Jan 20, 2015

Author Owner

Oh boy! Thanks :)


```bash
npm install punycode
Expand All @@ -38,7 +38,7 @@ In a browser:
<script src="punycode.js"></script>
```

In [Narwhal](http://narwhaljs.org/), [Node.js](http://nodejs.org/), and [RingoJS](http://ringojs.org/):
In [Node.js](https://nodejs.org/), [io.js](https://iojs.org/), [Narwhal](http://narwhaljs.org/), and [RingoJS](http://ringojs.org/):

```js
var punycode = require('punycode');
Expand Down Expand Up @@ -106,7 +106,7 @@ punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');

### `punycode.toASCII(input)`

Converts a Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that's already in ASCII.
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain thats already in ASCII.

```js
// encode domain names
Expand Down
12 changes: 6 additions & 6 deletions package.json
Expand Up @@ -41,13 +41,13 @@
"test": "node tests/tests.js"
},
"devDependencies": {
"coveralls": "^2.10.1",
"coveralls": "^2.11.2",
"grunt": "^0.4.5",
"grunt-contrib-uglify": "^0.5.0",
"grunt-shell": "^0.7.0",
"istanbul": "^0.2.13",
"qunit-extras": "^1.2.0",
"grunt-contrib-uglify": "^0.7.0",
"grunt-shell": "^1.1.1",
"istanbul": "^0.3.5",
"qunit-extras": "^1.4.1",
"qunitjs": "~1.11.0",
"requirejs": "^2.1.14"
"requirejs": "^2.1.15"
}
}
9 changes: 6 additions & 3 deletions punycode.js
Expand Up @@ -516,14 +516,17 @@
return punycode;
});
} else if (freeExports && freeModule) {
if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+
if (module.exports == freeExports) {
// in Node.js, io.js, or RingoJS v0.8.0+
freeModule.exports = punycode;
} else { // in Narwhal or RingoJS v0.7.0-
} else {
// in Narwhal or RingoJS v0.7.0-
for (key in punycode) {
punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
}
}
} else { // in Rhino or a web browser
} else {
// in Rhino or a web browser
root.punycode = punycode;
}

Expand Down
3 changes: 2 additions & 1 deletion tests/tests.js
Expand Up @@ -375,9 +375,10 @@
/*--------------------------------------------------------------------------*/

// configure QUnit and call `QUnit.start()` for
// Narwhal, Node.js, PhantomJS, Rhino, and RingoJS
// Narwhal, Node.js, io.js, PhantomJS, Rhino, and RingoJS
if (!root.document || root.phantom) {
QUnit.config.noglobals = true;
QUnit.config.hidepassed = true;
QUnit.start();
}

Expand Down

0 comments on commit e1d4f59

Please sign in to comment.