@@ -15,7 +15,7 @@ const delimiter = '-'; // '\x2D'
1515
1616/** Regular expressions */
1717const regexPunycode = / ^ x n - - / ;
18- const regexNonASCII = / [ ^ \x20 - \x7E ] / ; // unprintable ASCII chars + non-ASCII chars
18+ const regexNonASCII = / [ ^ \0 - \x7E ] / ; // non-ASCII chars
1919const regexSeparators = / [ \x2E \u3002 \uFF0E \uFF61 ] / g; // RFC 3490 separators
2020
2121/** Error messages */
@@ -210,7 +210,7 @@ const decode = function(input) {
210210basic = 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
215215if ( input . charCodeAt ( j ) >= 0x80 ) {
216216error ( '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`.
231231let 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
234234if ( index >= inputLength ) {
235235error ( 'invalid-input' ) ;
@@ -345,7 +345,7 @@ const encode = function(input) {
345345if ( currentValue == n ) {
346346// Represent delta as a generalized variable-length integer.
347347let q = delta ;
348- for ( var k = base ; /* no condition */ ; k += base ) {
348+ for ( let k = base ; /* no condition */ ; k += base ) {
349349const t = k <= bias ? tMin : ( k >= bias + tMax ? tMax : k - bias ) ;
350350if ( q < t ) {
351351break ;
@@ -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