fix(shared): missed Symbol judge in looseEqual (#3553)

This commit is contained in:
netcon
2022-05-10 10:15:26 +08:00
committed by GitHub
parent c355c4b784
commit 0aeb4bc9bf
2 changed files with 18 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
import { isArray, isDate, isObject } from './'
import { isArray, isDate, isObject, isSymbol } from './'
function looseCompareArrays(a: any[], b: any[]) {
if (a.length !== b.length) return false
@@ -16,6 +16,11 @@ export function looseEqual(a: any, b: any): boolean {
if (aValidType || bValidType) {
return aValidType && bValidType ? a.getTime() === b.getTime() : false
}
aValidType = isSymbol(a)
bValidType = isSymbol(b)
if (aValidType || bValidType) {
return a === b
}
aValidType = isArray(a)
bValidType = isArray(b)
if (aValidType || bValidType) {