fix: ensure a nake object without built-in method

and remove non-necessary prototype chain
This commit is contained in:
gholk 2026-05-20 23:45:15 +08:00
parent 98b92d562a
commit e5619e8ef1

View file

@ -1956,8 +1956,8 @@ function setDeepProperty(obj, value, target) {
* Merges two objects and any child objects they may have
*/
export function mergeDeep(o1, o2) {
if (o1 === null) return Object.assign({}, o2)
const r = Array.isArray(o1) ? o1.slice() : Object.create(o1)
if (o1 === null) return o(o2)
const r = Array.isArray(o1) ? o1.slice() : o({})
Object.assign(r, o1, o2)
if (o2 === undefined) return r
Object.keys(o1)