7
src/editor/shared/cloneValue.ts
Normal file
7
src/editor/shared/cloneValue.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export function cloneValue<T>(value: T): T {
|
||||
if (typeof structuredClone === 'function') {
|
||||
return structuredClone(value);
|
||||
}
|
||||
|
||||
return JSON.parse(JSON.stringify(value)) as T;
|
||||
}
|
||||
Reference in New Issue
Block a user