node_modules/es-abstract/2021/AbstractEqualityComparison.js in immosquare-cleaner-0.1.60 vs node_modules/es-abstract/2021/AbstractEqualityComparison.js in immosquare-cleaner-0.1.61

- old
+ new

@@ -4,51 +4,50 @@ var StringToBigInt = require('./StringToBigInt'); var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); -var isNaN = require('../helpers/isNaN'); +var isNaN = require('math-intrinsics/isNaN'); +var isObject = require('../helpers/isObject'); // https://262.ecma-international.org/11.0/#sec-abstract-equality-comparison module.exports = function AbstractEqualityComparison(x, y) { - var xType = Type(x); - var yType = Type(y); - if (xType === yType) { + if (Type(x) === Type(y)) { return StrictEqualityComparison(x, y); } if (x == null && y == null) { return true; } - if (xType === 'Number' && yType === 'String') { + if (typeof x === 'number' && typeof y === 'string') { return AbstractEqualityComparison(x, ToNumber(y)); } - if (xType === 'String' && yType === 'Number') { + if (typeof x === 'string' && typeof y === 'number') { return AbstractEqualityComparison(ToNumber(x), y); } - if (xType === 'BigInt' && yType === 'String') { + if (typeof x === 'bigint' && typeof y === 'string') { var n = StringToBigInt(y); if (isNaN(n)) { return false; } return AbstractEqualityComparison(x, n); } - if (xType === 'String' && yType === 'BigInt') { + if (typeof x === 'string' && typeof y === 'bigint') { return AbstractEqualityComparison(y, x); } - if (xType === 'Boolean') { + if (typeof x === 'boolean') { return AbstractEqualityComparison(ToNumber(x), y); } - if (yType === 'Boolean') { + if (typeof y === 'boolean') { return AbstractEqualityComparison(x, ToNumber(y)); } - if ((xType === 'String' || xType === 'Number' || xType === 'BigInt' || xType === 'Symbol') && yType === 'Object') { + if ((typeof x === 'string' || typeof x === 'number' || typeof x === 'bigint' || typeof x === 'symbol') && isObject(y)) { return AbstractEqualityComparison(x, ToPrimitive(y)); } - if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'BigInt' || yType === 'Symbol')) { + if (isObject(x) && (typeof y === 'string' || typeof y === 'number' || typeof y === 'bigint' || typeof y === 'symbol')) { return AbstractEqualityComparison(ToPrimitive(x), y); } - if ((xType === 'BigInt' && yType === 'Number') || (xType === 'Number' && yType === 'BigInt')) { + if ((typeof x === 'bigint' && typeof y === 'number') || (typeof x === 'number' && typeof y === 'bigint')) { if (isNaN(x) || isNaN(y) || x === Infinity || y === Infinity || x === -Infinity || y === -Infinity) { return false; } return x == y; // eslint-disable-line eqeqeq }