Skip to content

Commit

Permalink
use self-compare NaN check
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Aug 20, 2024
1 parent d8437f5 commit 9294082
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/core-js/modules/web.url-search-params.constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ var TypeError = globalThis.TypeError;
var encodeURIComponent = globalThis.encodeURIComponent;
var fromCharCode = String.fromCharCode;
var fromCodePoint = getBuiltIn('String', 'fromCodePoint');
var $isNaN = isNaN;
var $parseInt = parseInt;
var charAt = uncurryThis(''.charAt);
var join = uncurryThis([].join);
Expand Down Expand Up @@ -119,7 +118,8 @@ var decode = function (input) {

var octet = parseHexOctet(input, i + 1);

if ($isNaN(octet)) {
// eslint-disable-next-line no-self-compare -- NaN check
if (octet !== octet) {
result += decodedChar;
i++;
continue;
Expand All @@ -146,7 +146,8 @@ var decode = function (input) {

var nextByte = parseHexOctet(input, i + 1);

if ($isNaN(nextByte)) {
// eslint-disable-next-line no-self-compare -- NaN check
if (nextByte !== nextByte) {
i += 3;
break;
}
Expand Down

0 comments on commit 9294082

Please sign in to comment.