From 4f6c4a8405ad3e0700d6f14cede236943bf0116d Mon Sep 17 00:00:00 2001 From: haoziqaq <357229046@qq.com> Date: Mon, 4 Nov 2024 02:52:05 +0800 Subject: [PATCH] fix: fix isEqual --- src/general.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/general.ts b/src/general.ts index 13229aa..453aea1 100644 --- a/src/general.ts +++ b/src/general.ts @@ -259,6 +259,16 @@ export function isEqualWith(value: any, other: any, fn: (value: any, other: any) return value.every((v, i) => baseIsEqual(v, other[i], cache)) } + if ( + (toRawType(value) === 'String' && toRawType(other) === 'String') || + (toRawType(value) === 'Number' && toRawType(other) === 'Number') || + (toRawType(value) === 'Boolean' && toRawType(other) === 'Boolean') || + (toRawType(value) === 'BigInt' && toRawType(other) === 'BigInt') || + (toRawType(value) === 'Symbol' && toRawType(other) === 'Symbol') + ) { + return value.valueOf() === other.valueOf() + } + if (isPlainObject(value) && isPlainObject(other)) { const valueOwnKeys = [...Object.keys(value), ...Object.getOwnPropertySymbols(value)] const otherOwnKeys = [...Object.keys(other), ...Object.getOwnPropertySymbols(other)]