import cavar_type from "../cavar_type";
/**
* 功能:深拷贝对象或数组
* @param {object|array} data - 目标对象
* @returns {object|array} -深拷贝对象或数组
*/
function clone_dep(data) {
const type_data = cavar_type(data);
let type;
if (type_data === "object") {
type = {};
} else if (type_data === "array") {
type = [];
} else {
return data;
}
for (var key in data) {
type[key] = clone_dep(data[key]);
}
return type;
}
export default clone_dep;