Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/es-abstract/2019/AbstractEqualityComparison.js
r0c6b92a r79a0317 5 5 var Type = require('./Type'); 6 6 7 var isObject = require('../helpers/isObject'); 8 7 9 // https://262.ecma-international.org/6.0/#sec-abstract-equality-comparison 8 10 9 11 module.exports = function AbstractEqualityComparison(x, y) { 10 var xType = Type(x); 11 var yType = Type(y); 12 if (xType === yType) { 12 if (Type(x) === Type(y)) { 13 13 return x === y; // ES6+ specified this shortcut anyways. 14 14 } … … 16 16 return true; 17 17 } 18 if ( xType === 'Number' && yType === 'String') {18 if (typeof x === 'number' && typeof y === 'string') { 19 19 return AbstractEqualityComparison(x, ToNumber(y)); 20 20 } 21 if ( xType === 'String' && yType === 'Number') {21 if (typeof x === 'string' && typeof y === 'number') { 22 22 return AbstractEqualityComparison(ToNumber(x), y); 23 23 } 24 if ( xType === 'Boolean') {24 if (typeof x === 'boolean') { 25 25 return AbstractEqualityComparison(ToNumber(x), y); 26 26 } 27 if ( yType === 'Boolean') {27 if (typeof y === 'boolean') { 28 28 return AbstractEqualityComparison(x, ToNumber(y)); 29 29 } 30 if (( xType === 'String' || xType === 'Number' || xType === 'Symbol') && yType === 'Object') {30 if ((typeof x === 'string' || typeof x === 'number' || typeof x === 'symbol') && isObject(y)) { 31 31 return AbstractEqualityComparison(x, ToPrimitive(y)); 32 32 } 33 if ( xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'Symbol')) {33 if (isObject(x) && (typeof y === 'string' || typeof y === 'number' || typeof y === 'symbol')) { 34 34 return AbstractEqualityComparison(ToPrimitive(x), y); 35 35 }
Note:
See TracChangeset
for help on using the changeset viewer.