Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: update punycode to 2.1.1 #21768

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/punycode.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const delimiter = '-'; // '\x2D'

/** Regular expressions */
const regexPunycode = /^xn--/;
const regexNonASCII = /[^\x20-\x7E]/; // unprintable ASCII chars + non-ASCII chars
const regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators

/** Error messages */
Expand Down Expand Up @@ -210,7 +210,7 @@ const decode = function(input) {
basic = 0;
}

for (var j = 0; j < basic; ++j) {
for (let j = 0; j < basic; ++j) {
// if it's not a basic code point
if (input.charCodeAt(j) >= 0x80) {
error('not-basic');
Expand All @@ -221,15 +221,15 @@ const decode = function(input) {
// Main decoding loop: start just after the last delimiter if any basic code
// points were copied; start at the beginning otherwise.

for (var index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {

// `index` is the index of the next character to be consumed.
// Decode a generalized variable-length integer into `delta`,
// which gets added to `i`. The overflow checking is easier
// if we increase `i` as we go, then subtract off its starting
// value at the end to obtain `delta`.
let oldi = i;
for (var w = 1, k = base; /* no condition */; k += base) {
for (let w = 1, k = base; /* no condition */; k += base) {

if (index >= inputLength) {
error('invalid-input');
Expand Down Expand Up @@ -345,7 +345,7 @@ const encode = function(input) {
if (currentValue == n) {
// Represent delta as a generalized variable-length integer.
let q = delta;
for (var k = base; /* no condition */; k += base) {
for (let k = base; /* no condition */; k += base) {
const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
if (q < t) {
break;
Expand Down Expand Up @@ -419,7 +419,7 @@ const punycode = {
* @memberOf punycode
* @type String
*/
'version': '2.0.0',
'version': '2.1.0',
Copy link
Contributor

@mscdex mscdex Jul 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? The PR title says this is an upgrade to 2.1.1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did npm install [email protected] so...uh...mistake in the punycode release? /cc @mathiasbynens

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was missed in the 2.1.1 release. The code did not change in that release so it should be fine to land this as is.

/**
* An object of methods to convert from JavaScript's internal character
* representation (UCS-2) to Unicode code points, and back.
Expand Down