/**
 * @since Last modified: 2024-01-20 14:00:39
 * @function deepClone
 * @description Copy an array or object.Allow key to Symbol type.This types of value will be output directly,include Number,String,Boolean,Symbol,HTML*Element and Function.
 * @param {*} data  - Fill in an array or object.
 * @returns {Object} - Return a new object with different memory addresses
 * @see {@link https://codepen.io/axui/pen/RwvVzxE|demo @ codepen}
 * @example
 * let x ={a:'',b:0,c:[]};
 * ax.deepClone(x);
 * let y =[{},{},{}];
 * ax.clone(y);
 * <!--return a new object-->
 */
'use strict';
import getDataType from './getDataType';
const deepClone = (data) => {
    let dataType = getDataType(data), result;
    if (dataType === 'Object') {
        let newObj = {}, symbols = Object.getOwnPropertySymbols(data);
        for (let k in data) {
            newObj[k] = deepClone(data[k]);
        }
        if (symbols.length > 0) {
            for (let k of symbols) {
                newObj[k] = deepClone(data[k]);
            }
        }
        result = newObj;
    }
    else if (dataType === 'Array') {
        result = data.map((k) => deepClone(k));
    }
    else if (dataType === 'Date') {
        result = new Date(data);
    }
    else {
        result = data;
    }
    return result;
};
export default deepClone;
