MCPcopy Index your code
hub / github.com/1Panel-dev/1Panel / deepCopy

Function deepCopy

frontend/src/utils/misc.ts:3–18  ·  view source on GitHub ↗
(obj: any)

Source from the content-addressed store, hash-verified

1import { toUnicode } from 'punycode';
2
3export function deepCopy<T>(obj: any): T {
4 let newObj: any;
5 try {
6 newObj = obj.push ? [] : {};
7 } catch (error) {
8 newObj = {};
9 }
10 for (let attr in obj) {
11 if (typeof obj[attr] === 'object') {
12 newObj[attr] = deepCopy(obj[attr]);
13 } else {
14 newObj[attr] = obj[attr];
15 }
16 }
17 return newObj;
18}
19
20export function debounce(func: Function, wait: number) {
21 let timeout: NodeJS.Timeout | null = null;

Callers 15

addHostFunction · 0.90
testByInfoFunction · 0.90
editHostFunction · 0.90
updateProxyFunction · 0.90
createCertFunction · 0.90
editCertFunction · 0.90
checkBackupFunction · 0.90
listBucketFunction · 0.90
addBackupFunction · 0.90
editBackupFunction · 0.90
CreateAlertFunction · 0.90
createFtpFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected