Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/es-abstract/2024/IsLooselyEqual.js
r0c6b92a r79a0317 1 1 'use strict'; 2 2 3 var isFinite = require(' ../helpers/isFinite');3 var isFinite = require('math-intrinsics/isFinite'); 4 4 5 5 var IsStrictlyEqual = require('./IsStrictlyEqual'); … … 9 9 var Type = require('./Type'); 10 10 11 var isObject = require('../helpers/isObject'); 12 11 13 // https://262.ecma-international.org/13.0/#sec-islooselyequal 12 14 13 15 module.exports = function IsLooselyEqual(x, y) { 14 var xType = Type(x); 15 var yType = Type(y); 16 if (xType === yType) { 16 if (Type(x) === Type(y)) { 17 17 return IsStrictlyEqual(x, y); 18 18 } … … 20 20 return true; 21 21 } 22 if ( xType === 'Number' && yType === 'String') {22 if (typeof x === 'number' && typeof y === 'string') { 23 23 return IsLooselyEqual(x, ToNumber(y)); 24 24 } 25 if ( xType === 'String' && yType === 'Number') {25 if (typeof x === 'string' && typeof y === 'number') { 26 26 return IsLooselyEqual(ToNumber(x), y); 27 27 } 28 if ( xType === 'BigInt' && yType === 'String') {28 if (typeof x === 'bigint' && typeof y === 'string') { 29 29 var n = StringToBigInt(y); 30 30 if (typeof n === 'undefined') { … … 33 33 return IsLooselyEqual(x, n); 34 34 } 35 if ( xType === 'String' && yType === 'BigInt') {35 if (typeof x === 'string' && typeof y === 'bigint') { 36 36 return IsLooselyEqual(y, x); 37 37 } 38 if ( xType === 'Boolean') {38 if (typeof x === 'boolean') { 39 39 return IsLooselyEqual(ToNumber(x), y); 40 40 } 41 if ( yType === 'Boolean') {41 if (typeof y === 'boolean') { 42 42 return IsLooselyEqual(x, ToNumber(y)); 43 43 } 44 if (( xType === 'String' || xType === 'Number' || xType === 'Symbol' || xType === 'BigInt') && yType === 'Object') {44 if ((typeof x === 'string' || typeof x === 'number' || typeof x === 'symbol' || typeof x === 'bigint') && isObject(y)) { 45 45 return IsLooselyEqual(x, ToPrimitive(y)); 46 46 } 47 if ( xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'Symbol' || yType === 'BigInt')) {47 if (isObject(x) && (typeof y === 'string' || typeof y === 'number' || typeof y === 'symbol' || typeof y === 'bigint')) { 48 48 return IsLooselyEqual(ToPrimitive(x), y); 49 49 } 50 if (( xType === 'BigInt' && yType === 'Number') || (xType === 'Number' && yType === 'BigInt')) {50 if ((typeof x === 'bigint' && typeof y === 'number') || (typeof x === 'number' && typeof y === 'bigint')) { 51 51 if (!isFinite(x) || !isFinite(y)) { 52 52 return false;
Note:
See TracChangeset
for help on using the changeset viewer.