{"size": 690, "ext": "js", "max_stars_repo_path": "src/common/util/CommonFunctions.js", "max_stars_repo_name": "Alrecue/Dun-Cookie-Vue", "max_stars_repo_stars_event_min_datetime": "2021-11-06T15:03:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-06T15:03:59.000Z", "max_issues_repo_path": "src/common/util/CommonFunctions.js", "max_issues_repo_name": "Alrecue/Dun-Cookie-Vue", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/common/util/CommonFunctions.js", "max_forks_repo_name": "Alrecue/Dun-Cookie-Vue", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.7931034483, "max_line_length": 76, "alphanum_fraction": 0.4652173913}
/**
 * 这里放不方便分类的公共方法
 */

/**
 * 递归合并对象
 * <p>
 * <strong>注意：子元素是数组的会直接复制而不会递归合并</strong>
 */
function deepAssign(target, obj) {
    if (!target) target = Array.isArray(obj) ? [] : {};
    if (obj && typeof obj === "object") {
        for (const key in obj) {
            if (obj.hasOwnProperty(key)) {
                //判断obj子元素是否为对象，如果是则递归复制，否则简单复制
                const val = obj[key];
                if (val && typeof val === "object" && !Array.isArray(val)) {
                    target[key] = deepAssign(target[key], obj[key]);
                } else {
                    target[key] = val;
                }
            }
        }
    }
    return target;
}

export {deepAssign};
