@tuoyuan/map-adapter-lib
Version:
地图适配器库
19 lines (18 loc) • 517 B
JavaScript
const f = (n, ...c) => {
if (typeof n != "object" || n === null)
throw new Error("Target must be an object.");
for (const e of c)
if (!(typeof e != "object" || e === null)) {
for (const o in e)
if (Object.prototype.hasOwnProperty.call(e, o))
if (typeof e[o] == "object" && e[o] !== null) {
const r = Array.isArray(e[o]) ? [] : {};
n[o] = f(r, n[o], e[o]);
} else
n[o] = e[o] ?? n[o];
}
return n;
};
export {
f as deepAssign
};