clone impl

This commit is contained in:
Diego Imbert
2025-06-26 11:36:36 +02:00
parent 835f1d2ec9
commit 83e5bfbc17
+6
View File
@@ -1432,4 +1432,10 @@ export function scroll_into_view_if_needed_polyfill(elem: Element, centerIfNeede
return observer // return for testing
}
export function clone<T>(t: T): T {
if (typeof t === 'function') throw new Error('Cannot clone a function')
if (typeof t === 'object') return stateSnapshot(t) as T
return t
}
export const editorPositionMap: Record<string, IPosition> = {}