const _completeDeepClone = (target, map = new Map()) => {
if (target === null) return target;
if (typeof target !== "object") return target;
const constructor = target.constructor;
if (/^(Function|RegExp|Date|Map|Set)$/i.test(constructor.name))
return new constructor(target);
if (map.get(target)) return map.get(target);
const cloneTarget = Array.isArray(target) ? [] : {};
map.set(target, cloneTarget);
for (prop in target) {
if (target.hasOwnProperty(prop)) {
cloneTarget[prop] = _completeDeepClone(target[prop], map);
}
}
return cloneTarget;
};