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