first commit
This commit is contained in:
22
node_modules/vant/es/utils/deep-assign.mjs
generated
vendored
Normal file
22
node_modules/vant/es/utils/deep-assign.mjs
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { isDef, isObject } from "./basic.mjs";
|
||||
const { hasOwnProperty } = Object.prototype;
|
||||
function assignKey(to, from, key) {
|
||||
const val = from[key];
|
||||
if (!isDef(val)) {
|
||||
return;
|
||||
}
|
||||
if (!hasOwnProperty.call(to, key) || !isObject(val)) {
|
||||
to[key] = val;
|
||||
} else {
|
||||
to[key] = deepAssign(Object(to[key]), val);
|
||||
}
|
||||
}
|
||||
function deepAssign(to, from) {
|
||||
Object.keys(from).forEach((key) => {
|
||||
assignKey(to, from, key);
|
||||
});
|
||||
return to;
|
||||
}
|
||||
export {
|
||||
deepAssign
|
||||
};
|
||||
Reference in New Issue
Block a user