Files
meeting-room/frontend/node_modules/es-abstract/2023/IsLooselyEqual.js
flying-hero 96f6318101 📦 添加虚拟环境和启动脚本
新增:
- backend/venv/ - Python 虚拟环境
- backend/start.sh - 启动脚本(使用虚拟环境)
- backend/requirements.txt - 依赖列表
- .gitignore - 忽略虚拟环境和缓存文件

说明:
- 每个项目使用独立虚拟环境
- 避免依赖冲突
- 启动脚本自动创建和激活虚拟环境
2026-04-04 18:29:02 +08:00

59 lines
1.8 KiB
JavaScript

'use strict';
var isFinite = require('math-intrinsics/isFinite');
var isObject = require('es-object-atoms/isObject');
var IsStrictlyEqual = require('./IsStrictlyEqual');
var StringToBigInt = require('./StringToBigInt');
var ToNumber = require('./ToNumber');
var ToPrimitive = require('./ToPrimitive');
var isSameType = require('../helpers/isSameType');
// https://262.ecma-international.org/13.0/#sec-islooselyequal
module.exports = function IsLooselyEqual(x, y) {
if (isSameType(x, y)) {
return IsStrictlyEqual(x, y);
}
if (x == null && y == null) {
return true;
}
if (typeof x === 'number' && typeof y === 'string') {
return IsLooselyEqual(x, ToNumber(y));
}
if (typeof x === 'string' && typeof y === 'number') {
return IsLooselyEqual(ToNumber(x), y);
}
if (typeof x === 'bigint' && typeof y === 'string') {
var n = StringToBigInt(y);
if (typeof n === 'undefined') {
return false;
}
return IsLooselyEqual(x, n);
}
if (typeof x === 'string' && typeof y === 'bigint') {
return IsLooselyEqual(y, x);
}
if (typeof x === 'boolean') {
return IsLooselyEqual(ToNumber(x), y);
}
if (typeof y === 'boolean') {
return IsLooselyEqual(x, ToNumber(y));
}
if ((typeof x === 'string' || typeof x === 'number' || typeof x === 'symbol' || typeof x === 'bigint') && isObject(y)) {
return IsLooselyEqual(x, ToPrimitive(y));
}
if (isObject(x) && (typeof y === 'string' || typeof y === 'number' || typeof y === 'symbol' || typeof y === 'bigint')) {
return IsLooselyEqual(ToPrimitive(x), y);
}
if ((typeof x === 'bigint' && typeof y === 'number') || (typeof x === 'number' && typeof y === 'bigint')) {
if (!isFinite(x) || !isFinite(y)) {
return false;
}
// eslint-disable-next-line eqeqeq
return x == y; // shortcut for step 13.b.
}
return false;
};