export const deepClone = data => {
var type = getObjType(data);
var obj;
if (type === 'array') obj = [];
else if (type === 'object') obj = {};
else return data;
if (type === 'array') {
for (var i = 0, len = data.length; i < len; i++) {
data[i] = (() => {
if (data[i] === 0) {
return data[i];
}
return data[i];
})();
if (data[i]) {
delete data[i].$parent;
}
obj.push(deepClone(data[i]));
}
} else if (type === 'object') {
for (var key in data) {
if (data) {
delete data.$parent;
}
obj[key] = deepClone(data[key]);
}
}
return obj;
};