Skip to content

Commit 90c6b40

Browse files
author
Hector Arce De Las Heras
committed
Improve polifyll for structuredClone
1 parent b7b5608 commit 90c6b40

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
// eslint-disable-next-line node/no-extraneous-import
21
import ungapStructuredClone from '@ungap/structured-clone';
32

4-
export const structuredClone = self.structuredClone ?? ungapStructuredClone;
3+
let structuredClone;
4+
if (typeof self !== 'undefined' && self.structuredClone) {
5+
structuredClone = self.structuredClone;
6+
} else {
7+
structuredClone = ungapStructuredClone;
8+
}
9+
export { structuredClone };

0 commit comments

Comments
 (0)