fix: code check (#112)

This commit is contained in:
yaoyun8 2023-11-30 17:08:14 +08:00 committed by GitHub
parent 8ed61ca311
commit a8379f2bda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -251,11 +251,12 @@ function cloneObject(target, map, _deepClone) {
return res
}
export function naiveDeepClone(target) {
export function nativeDeepClone(target) {
try {
return structuredClone(target)
} catch (error) {
// target is no serializable
return undefined
}
}
@ -297,7 +298,7 @@ function _deepClone(target, map) {
return target
}
let res = naiveDeepClone(copyTarget)
let res = nativeDeepClone(copyTarget)
if (res) {
map.set(target, res)

View File

@ -42,9 +42,9 @@ function recurseChildren(children, state, description, result) {
} else if (children?.type === 'JSExpression') {
result.push(`{{ ${children.value.replace(/this\.(props\.)?/g, '')} }}`)
for (const key in description.jsResource) {
Object.keys(description.jsResource).forEach((key) => {
description.jsResource[key] = description.jsResource[key] || children.value.includes(`.${key}.`)
}
})
} else if (children?.type === 'i18n') {
result.push(`{{ t('${children.key}') }}`)
} else {