From 4cd6fa6fa08423f1358bdc973801ae83d2fe73c3 Mon Sep 17 00:00:00 2001 From: Denis Pushkarev Date: Wed, 1 Sep 2021 20:53:57 +0700 Subject: [PATCH] fix a es3 reserved word usage, close #980 --- CHANGELOG.md | 3 ++- packages/core-js/modules/web.url.js | 30 ++++++++++++++--------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb405b518560..971107e277e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ - [Accessible `Object.prototype.hasOwnProperty` (`Object.hasOwn`) proposal](https://github.com/tc39/proposal-accessible-object-hasownproperty) moved to the stable ES, [per August 2021 TC39 meeting](https://github.com/babel/proposals/issues/76#issuecomment-909288348) - [Relative indexing method (`.at`) proposal](https://github.com/tc39/proposal-relative-indexing-method) moved to the stable ES, [per August 2021 TC39 meeting](https://github.com/babel/proposals/issues/76#issuecomment-909285053) - Exposed by default the stable version of `String.prototype.at`. It was not exposed because of the conflict with the alternative obsolete proposal (that will be completely removed in the next major version). For the backward compatibility, in the case of loading this proposal, it will be overwritten. -- Some more iteration closing fixes +- Some more iteration closing fixes +- Fixed a ES3 reserved word usage, [#980](https://github.com/zloirock/core-js/issues/980) ##### 3.16.4 - 2021.08.29 - `AsyncFromSyncIterator` made stricter, related mainly to `AsyncIterator.from` and `AsyncIterator.prototype.flatMap` diff --git a/packages/core-js/modules/web.url.js b/packages/core-js/modules/web.url.js index df3d9e2054bc..37274f827c13 100644 --- a/packages/core-js/modules/web.url.js +++ b/packages/core-js/modules/web.url.js @@ -118,19 +118,19 @@ var parseIPv6 = function (input) { var pointer = 0; var value, length, numbersSeen, ipv4Piece, number, swaps, swap; - var char = function () { + var chr = function () { return input.charAt(pointer); }; - if (char() == ':') { + if (chr() == ':') { if (input.charAt(1) != ':') return; pointer += 2; pieceIndex++; compress = pieceIndex; } - while (char()) { + while (chr()) { if (pieceIndex == 8) return; - if (char() == ':') { + if (chr() == ':') { if (compress !== null) return; pointer++; pieceIndex++; @@ -138,25 +138,25 @@ var parseIPv6 = function (input) { continue; } value = length = 0; - while (length < 4 && HEX.test(char())) { - value = value * 16 + parseInt(char(), 16); + while (length < 4 && HEX.test(chr())) { + value = value * 16 + parseInt(chr(), 16); pointer++; length++; } - if (char() == '.') { + if (chr() == '.') { if (length == 0) return; pointer -= length; if (pieceIndex > 6) return; numbersSeen = 0; - while (char()) { + while (chr()) { ipv4Piece = null; if (numbersSeen > 0) { - if (char() == '.' && numbersSeen < 4) pointer++; + if (chr() == '.' && numbersSeen < 4) pointer++; else return; } - if (!DIGIT.test(char())) return; - while (DIGIT.test(char())) { - number = parseInt(char(), 10); + if (!DIGIT.test(chr())) return; + while (DIGIT.test(chr())) { + number = parseInt(chr(), 10); if (ipv4Piece === null) ipv4Piece = number; else if (ipv4Piece == 0) return; else ipv4Piece = ipv4Piece * 10 + number; @@ -169,10 +169,10 @@ var parseIPv6 = function (input) { } if (numbersSeen != 4) return; break; - } else if (char() == ':') { + } else if (chr() == ':') { pointer++; - if (!char()) return; - } else if (char()) return; + if (!chr()) return; + } else if (chr()) return; address[pieceIndex++] = value; } if (compress !== null) {