summaryrefslogtreecommitdiff
path: root/packages/client/src/scripts/clone.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-12-27 14:36:33 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-12-27 14:36:33 +0900
commit9384f5399da39e53855beb8e7f8ded1aa56bf72e (patch)
treece5959571a981b9c4047da3c7b3fd080aa44222c /packages/client/src/scripts/clone.ts
parentwip: retention for dashboard (diff)
downloadsharkey-9384f5399da39e53855beb8e7f8ded1aa56bf72e.tar.gz
sharkey-9384f5399da39e53855beb8e7f8ded1aa56bf72e.tar.bz2
sharkey-9384f5399da39e53855beb8e7f8ded1aa56bf72e.zip
rename: client -> frontend
Diffstat (limited to 'packages/client/src/scripts/clone.ts')
-rw-r--r--packages/client/src/scripts/clone.ts18
1 files changed, 0 insertions, 18 deletions
diff --git a/packages/client/src/scripts/clone.ts b/packages/client/src/scripts/clone.ts
deleted file mode 100644
index 16fad24129..0000000000
--- a/packages/client/src/scripts/clone.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-// structredCloneが遅いため
-// SEE: http://var.blog.jp/archives/86038606.html
-
-type Cloneable = string | number | boolean | null | { [key: string]: Cloneable } | Cloneable[];
-
-export function deepClone<T extends Cloneable>(x: T): T {
- if (typeof x === 'object') {
- if (x === null) return x;
- if (Array.isArray(x)) return x.map(deepClone) as T;
- const obj = {} as Record<string, Cloneable>;
- for (const [k, v] of Object.entries(x)) {
- obj[k] = deepClone(v);
- }
- return obj as T;
- } else {
- return x;
- }
-}