mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-04 20:19:29 +08:00
11 lines
283 B
Text
11 lines
283 B
Text
export function cloneDeep(value) {
|
|
if (Array.isArray(value)) {
|
|
return value.map((child) => cloneDeep(child))
|
|
}
|
|
|
|
if (typeof value === 'object' && value !== null) {
|
|
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, cloneDeep(v)]))
|
|
}
|
|
|
|
return value
|
|
}
|