Skip to content

Commit 3cbcacc

Browse files
committed
perf: use structuredClone() for cloning
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
1 parent fa2aa7a commit 3cbcacc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ export const isWebWorker = () => {
293293
)
294294
}
295295

296-
const clone = <T extends object>(object: T): T => {
297-
return JSON.parse(JSON.stringify(object)) as T
296+
const clone = <T>(object: T): T => {
297+
return structuredClone<T>(object)
298298
}
299299

300300
export const buildInternalWorkerChoiceStrategyOptions = (

0 commit comments

Comments
 (0)