Skip to content

Commit ab10bfe

Browse files
committedJul 16, 2018
lib: update punycode to 2.1.1
PR-URL: #21768 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 210fea5 commit ab10bfe

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎lib/punycode.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const delimiter = '-'; // '\x2D'
1515

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

2121
/** Error messages */
@@ -210,7 +210,7 @@ const decode = function(input) {
210210
basic = 0;
211211
}
212212

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

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

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

234234
if (index >= inputLength) {
235235
error('invalid-input');
@@ -345,7 +345,7 @@ const encode = function(input) {
345345
if (currentValue == n) {
346346
// Represent delta as a generalized variable-length integer.
347347
let q = delta;
348-
for (var k = base; /* no condition */; k += base) {
348+
for (let k = base; /* no condition */; k += base) {
349349
const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
350350
if (q < t) {
351351
break;
@@ -419,7 +419,7 @@ const punycode = {
419419
* @memberOf punycode
420420
* @type String
421421
*/
422-
'version': '2.0.0',
422+
'version': '2.1.0',
423423
/**
424424
* An object of methods to convert from JavaScript's internal character
425425
* representation (UCS-2) to Unicode code points, and back.

0 commit comments

Comments
 (0)
Please sign in to comment.