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/2018/AbstractEqualityComparison.js

    r0c6b92a r79a0317  
    55var Type = require('./Type');
    66
     7var isObject = require('../helpers/isObject');
     8
    79// https://262.ecma-international.org/6.0/#sec-abstract-equality-comparison
    810
    911module.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)) {
    1313                return x === y; // ES6+ specified this shortcut anyways.
    1414        }
     
    1616                return true;
    1717        }
    18         if (xType === 'Number' && yType === 'String') {
     18        if (typeof x === 'number' && typeof y === 'string') {
    1919                return AbstractEqualityComparison(x, ToNumber(y));
    2020        }
    21         if (xType === 'String' && yType === 'Number') {
     21        if (typeof x === 'string' && typeof y === 'number') {
    2222                return AbstractEqualityComparison(ToNumber(x), y);
    2323        }
    24         if (xType === 'Boolean') {
     24        if (typeof x === 'boolean') {
    2525                return AbstractEqualityComparison(ToNumber(x), y);
    2626        }
    27         if (yType === 'Boolean') {
     27        if (typeof y === 'boolean') {
    2828                return AbstractEqualityComparison(x, ToNumber(y));
    2929        }
    30         if ((xType === 'String' || xType === 'Number' || xType === 'Symbol') && yType === 'Object') {
     30        if ((typeof x === 'string' || typeof x === 'number' || typeof x === 'symbol') && isObject(y)) {
    3131                return AbstractEqualityComparison(x, ToPrimitive(y));
    3232        }
    33         if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'Symbol')) {
     33        if (isObject(x) && (typeof y === 'string' || typeof y === 'number' || typeof y === 'symbol')) {
    3434                return AbstractEqualityComparison(ToPrimitive(x), y);
    3535        }
Note: See TracChangeset for help on using the changeset viewer.