From 404c01dc65661af1a515b59031ba2f7844bab692 Mon Sep 17 00:00:00 2001 From: bianxuerui <407955981@qq.com> Date: Thu, 26 Sep 2024 11:27:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=87=E6=BB=A4=E6=8E=89=E5=90=AB?= =?UTF-8?q?=E6=9C=89NaN=E5=80=BC=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/arrayOperation.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/utils/arrayOperation.ts b/src/utils/arrayOperation.ts index 08c8c31a..9ba7968b 100644 --- a/src/utils/arrayOperation.ts +++ b/src/utils/arrayOperation.ts @@ -30,13 +30,17 @@ export function isObjectValueEqual(a: T, b: T): boolean { if (aProps.length != bProps.length) return false; for (let i = 0; i < aProps.length; i++) { let propName = aProps[i]; - let propA = a[propName]; - let propB = b[propName]; + let propA = (a as any)[propName]; + let propB = (b as any)[propName]; if (!b.hasOwnProperty(propName)) return false; if (propA instanceof Object) { if (!isObjectValueEqual(propA, propB)) return false; } else if (propA !== propB) { - return false; + if (!(Number.isNaN(propA) && Number.isNaN(propB))) { + return false; + } else { + throw new Error('NaN 不能比较'); + } } } return true; -- Gitee