Ignore:
Timestamp:
01/21/25 03:08:24 (3 days ago)
Author:
stefan toskovski <stefantoska84@…>
Branches:
main
Parents:
0c6b92a
Message:

F4 Finalna Verzija

File:
1 edited

Legend:

Unmodified
Added
Removed
  • imaps-frontend/node_modules/es-abstract/2020/AbstractEqualityComparison.js

    r0c6b92a r79a0317  
    77var Type = require('./Type');
    88
    9 var isNaN = require('../helpers/isNaN');
     9var isNaN = require('math-intrinsics/isNaN');
     10var isObject = require('../helpers/isObject');
    1011
    1112// https://262.ecma-international.org/11.0/#sec-abstract-equality-comparison
    1213
    1314module.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)) {
    1716                return StrictEqualityComparison(x, y);
    1817        }
     
    2019                return true;
    2120        }
    22         if (xType === 'Number' && yType === 'String') {
     21        if (typeof x === 'number' && typeof y === 'string') {
    2322                return AbstractEqualityComparison(x, ToNumber(y));
    2423        }
    25         if (xType === 'String' && yType === 'Number') {
     24        if (typeof x === 'string' && typeof y === 'number') {
    2625                return AbstractEqualityComparison(ToNumber(x), y);
    2726        }
    28         if (xType === 'BigInt' && yType === 'String') {
     27        if (typeof x === 'bigint' && typeof y === 'string') {
    2928                var n = StringToBigInt(y);
    3029                if (isNaN(n)) {
     
    3332                return AbstractEqualityComparison(x, n);
    3433        }
    35         if (xType === 'String' && yType === 'BigInt') {
     34        if (typeof x === 'string' && typeof y === 'bigint') {
    3635                return AbstractEqualityComparison(y, x);
    3736        }
    38         if (xType === 'Boolean') {
     37        if (typeof x === 'boolean') {
    3938                return AbstractEqualityComparison(ToNumber(x), y);
    4039        }
    41         if (yType === 'Boolean') {
     40        if (typeof y === 'boolean') {
    4241                return AbstractEqualityComparison(x, ToNumber(y));
    4342        }
    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)) {
    4544                return AbstractEqualityComparison(x, ToPrimitive(y));
    4645        }
    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')) {
    4847                return AbstractEqualityComparison(ToPrimitive(x), y);
    4948        }
    50         if ((xType === 'BigInt' && yType === 'Number') || (xType === 'Number' && yType === 'BigInt')) {
     49        if ((typeof x === 'bigint' && typeof y === 'number') || (typeof x === 'number' && typeof y === 'bigint')) {
    5150                if (isNaN(x) || isNaN(y) || x === Infinity || y === Infinity || x === -Infinity || y === -Infinity) {
    5251                        return false;
Note: See TracChangeset for help on using the changeset viewer.