refactor(reactivity): refactor iteration key trigger logic + use more robust Map/Set check
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { isArray, isObject, isPlainObject } from './index'
|
||||
import { isArray, isMap, isObject, isPlainObject, isSet } from './index'
|
||||
|
||||
/**
|
||||
* For converting {{ interpolation }} values to displayed strings.
|
||||
@@ -13,14 +13,14 @@ export const toDisplayString = (val: unknown): string => {
|
||||
}
|
||||
|
||||
const replacer = (_key: string, val: any) => {
|
||||
if (val instanceof Map) {
|
||||
if (isMap(val)) {
|
||||
return {
|
||||
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val]) => {
|
||||
;(entries as any)[`${key} =>`] = val
|
||||
return entries
|
||||
}, {})
|
||||
}
|
||||
} else if (val instanceof Set) {
|
||||
} else if (isSet(val)) {
|
||||
return {
|
||||
[`Set(${val.size})`]: [...val.values()]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user