{"_id":"punycode.js","_rev":"3263739","name":"punycode.js","description":"A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.","dist-tags":{"latest":"2.3.1"},"maintainers":[{"name":"google-wombot","email":""},{"name":"mathias","email":""}],"time":{"modified":"2024-03-21T09:49:16.000Z","created":"2018-03-15T07:51:05.927Z","2.3.1":"2023-10-30T18:28:36.491Z","2.3.0":"2023-01-19T17:58:02.424Z","2.1.0":"2018-03-15T07:51:05.927Z"},"users":{},"author":{"name":"Mathias Bynens","url":"https://mathiasbynens.be/"},"repository":{"type":"git","url":"git+https://github.com/mathiasbynens/punycode.js.git"},"versions":{"2.3.1":{"name":"punycode.js","version":"2.3.1","description":"A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.","homepage":"https://mths.be/punycode","main":"punycode.js","jsnext:main":"punycode.es6.js","module":"punycode.es6.js","engines":{"node":">=6"},"keywords":["punycode","unicode","idn","idna","dns","url","domain"],"license":"MIT","author":{"name":"Mathias Bynens","url":"https://mathiasbynens.be/"},"contributors":[{"name":"Mathias Bynens","url":"https://mathiasbynens.be/"}],"repository":{"type":"git","url":"git+https://github.com/mathiasbynens/punycode.js.git"},"bugs":{"url":"https://github.com/mathiasbynens/punycode.js/issues"},"scripts":{"test":"mocha tests","build":"node scripts/prepublish.js"},"devDependencies":{"codecov":"^3.8.3","nyc":"^15.1.0","mocha":"^10.2.0"},"jspm":{"map":{"./punycode.js":{"node":"@node/punycode"}}},"_id":"punycode.js@2.3.1","gitHead":"9e1b2cda98d215d3a73fcbfe93c62e021f4ba768","_nodeVersion":"20.9.0","_npmVersion":"10.1.0","dist":{"shasum":"6b53e56ad75588234e79f4affa90972c7dd8cdb7","size":7601,"noattachment":false,"key":"/punycode.js/-/punycode.js-2.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/punycode.js/download/punycode.js-2.3.1.tgz"},"_npmUser":{"name":"google-wombot","email":"node-team-npm+wombot@google.com"},"directories":{},"maintainers":[{"name":"google-wombot","email":""},{"name":"mathias","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/punycode.js_2.3.1_1698690516239_0.530120365457522"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-10-30T18:28:36.491Z","publish_time":1698690516491,"_source_registry_name":"default","_cnpm_publish_time":1698690516491},"2.3.0":{"name":"punycode.js","version":"2.3.0","description":"A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.","homepage":"https://mths.be/punycode","main":"punycode.js","jsnext:main":"punycode.es6.js","module":"punycode.es6.js","engines":{"node":">=6"},"keywords":["punycode","unicode","idn","idna","dns","url","domain"],"license":"MIT","author":{"name":"Mathias Bynens","url":"https://mathiasbynens.be/"},"contributors":[{"name":"Mathias Bynens","url":"https://mathiasbynens.be/"}],"repository":{"type":"git","url":"git+https://github.com/mathiasbynens/punycode.js.git"},"bugs":{"url":"https://github.com/mathiasbynens/punycode.js/issues"},"scripts":{"test":"mocha tests","build":"node scripts/prepublish.js"},"devDependencies":{"codecov":"^1.0.1","istanbul":"^0.4.1","mocha":"^10.2.0"},"jspm":{"map":{"./punycode.js":{"node":"@node/punycode"}}},"gitHead":"44e6200b96c186ebc5de72dcce2bcdfe8a32bfbc","_id":"punycode.js@2.3.0","_nodeVersion":"14.21.2","_npmVersion":"6.14.17","dist":{"shasum":"6aaa35964ffecc676545995ecb65980bd8302f61","size":7380,"noattachment":false,"key":"/punycode.js/-/punycode.js-2.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/punycode.js/download/punycode.js-2.3.0.tgz"},"_npmUser":{"name":"google-wombot","email":"node-team-npm+wombot@google.com"},"directories":{},"maintainers":[{"name":"google-wombot","email":""},{"name":"mathias","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/punycode.js_2.3.0_1674151082233_0.865786884773649"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-01-19T17:58:02.424Z","publish_time":1674151082424,"_cnpm_publish_time":1674151082424},"2.1.0":{"name":"punycode.js","version":"2.1.0","description":"A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.","homepage":"https://mths.be/punycode","main":"punycode.js","jsnext:main":"punycode.es6.js","module":"punycode.es6.js","engines":{"node":">=6"},"keywords":["punycode","unicode","idn","idna","dns","url","domain"],"license":"MIT","author":{"name":"Mathias Bynens","url":"https://mathiasbynens.be/"},"contributors":[{"name":"Mathias Bynens","url":"https://mathiasbynens.be/"}],"repository":{"type":"git","url":"git+https://github.com/bestiejs/punycode.js.git"},"bugs":{"url":"https://github.com/bestiejs/punycode.js/issues"},"files":["LICENSE-MIT.txt","punycode.js","punycode.es6.js"],"scripts":{"test":"mocha tests","prepublish":"node scripts/prepublish.js"},"devDependencies":{"codecov":"^1.0.1","istanbul":"^0.4.1","mocha":"^2.5.3"},"jspm":{"map":{"./punycode.js":{"node":"@node/punycode"}}},"gitHead":"cc9ecb5781701a89c78f6e8392e266c5f84b17ae","_id":"punycode.js@2.1.0","_npmVersion":"5.6.0","_nodeVersion":"8.10.0","_npmUser":{"name":"mathias","email":"mathias@qiwi.be"},"dist":{"shasum":"f3937f7a914152c2dc17e9c280a2cf86a26b7cda","size":7238,"noattachment":false,"key":"/punycode.js/-/punycode.js-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/punycode.js/download/punycode.js-2.1.0.tgz"},"maintainers":[{"name":"google-wombot","email":""},{"name":"mathias","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/punycode.js_2.1.0_1521100265684_0.9005663333252123"},"_hasShrinkwrap":false,"publish_time":1521100265927,"_cnpm_publish_time":1521100265927,"_cnpmcore_publish_time":"2021-12-17T11:28:57.325Z"}},"readme":"# Punycode.js [![punycode on npm](https://img.shields.io/npm/v/punycode)](https://www.npmjs.com/package/punycode) [![](https://data.jsdelivr.com/v1/package/npm/punycode/badge)](https://www.jsdelivr.com/package/npm/punycode)\n\nPunycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).\n\nThis JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:\n\n* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C)\n* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c)\n* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c)\n* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)\n* [`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))\n\nThis project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).\n\nThis project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).\n\n## Installation\n\nVia [npm](https://www.npmjs.com/):\n\n```bash\nnpm install punycode --save\n```\n\nIn [Node.js](https://nodejs.org/):\n\n> ⚠️ Note that userland modules don't hide core modules.\n> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.\n> Use `require('punycode/')` to import userland modules rather than core modules.\n\n```js\nconst punycode = require('punycode/');\n```\n\n## API\n\n### `punycode.decode(string)`\n\nConverts a Punycode string of ASCII symbols to a string of Unicode symbols.\n\n```js\n// decode domain name parts\npunycode.decode('maana-pta'); // 'mañana'\npunycode.decode('--dqo34k'); // '☃-⌘'\n```\n\n### `punycode.encode(string)`\n\nConverts a string of Unicode symbols to a Punycode string of ASCII symbols.\n\n```js\n// encode domain name parts\npunycode.encode('mañana'); // 'maana-pta'\npunycode.encode('☃-⌘'); // '--dqo34k'\n```\n\n### `punycode.toUnicode(input)`\n\nConverts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.\n\n```js\n// decode domain names\npunycode.toUnicode('xn--maana-pta.com');\n// → 'mañana.com'\npunycode.toUnicode('xn----dqo34k.com');\n// → '☃-⌘.com'\n\n// decode email addresses\npunycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');\n// → 'джумла@джpумлатест.bрфa'\n```\n\n### `punycode.toASCII(input)`\n\nConverts 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 that’s already in ASCII.\n\n```js\n// encode domain names\npunycode.toASCII('mañana.com');\n// → 'xn--maana-pta.com'\npunycode.toASCII('☃-⌘.com');\n// → 'xn----dqo34k.com'\n\n// encode email addresses\npunycode.toASCII('джумла@джpумлатест.bрфa');\n// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'\n```\n\n### `punycode.ucs2`\n\n#### `punycode.ucs2.decode(string)`\n\nCreates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.\n\n```js\npunycode.ucs2.decode('abc');\n// → [0x61, 0x62, 0x63]\n// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:\npunycode.ucs2.decode('\\uD834\\uDF06');\n// → [0x1D306]\n```\n\n#### `punycode.ucs2.encode(codePoints)`\n\nCreates a string based on an array of numeric code point values.\n\n```js\npunycode.ucs2.encode([0x61, 0x62, 0x63]);\n// → 'abc'\npunycode.ucs2.encode([0x1D306]);\n// → '\\uD834\\uDF06'\n```\n\n### `punycode.version`\n\nA string representing the current Punycode.js version number.\n\n## For maintainers\n\n### How to publish a new release\n\n1. On the `main` branch, bump the version number in `package.json`:\n\n    ```sh\n    npm version patch -m 'Release v%s'\n    ```\n\n    Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).\n\n    Note that this produces a Git commit + tag.\n\n1. Push the release commit and tag:\n\n    ```sh\n    git push && git push --tags\n    ```\n\n    Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.\n\n## Author\n\n| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias \"Follow @mathias on Twitter\") |\n|---|\n| [Mathias Bynens](https://mathiasbynens.be/) |\n\n## License\n\nPunycode.js is available under the [MIT](https://mths.be/mit) license.\n","_attachments":{},"homepage":"https://mths.be/punycode","bugs":{"url":"https://github.com/mathiasbynens/punycode.js/issues"},"license":"MIT"}