Skip to content

Commit ba1c2ac

Browse files
Merge pull request #13 from hcengineering/fix-clone
Fix exception in object clone
2 parents 5570ac1 + f10cb78 commit ba1c2ac

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@hcengineering/core",
5+
"comment": "Fix object clone",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@hcengineering/core"
10+
}

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hcengineering/core",
3-
"version": "0.7.24",
3+
"version": "0.7.25",
44
"main": "lib/index.js",
55
"svelte": "src/index.ts",
66
"types": "types/index.d.ts",

packages/core/src/clone.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ export function getTypeOf (obj: any): string {
1414
return 'Array'
1515
}
1616

17-
const stringTag = ste && obj[Symbol.toStringTag]
17+
let stringTag: string | undefined
18+
if (ste) {
19+
try {
20+
stringTag = obj[Symbol.toStringTag]
21+
} catch {
22+
stringTag = undefined
23+
}
24+
}
1825
if (typeof stringTag === 'string') {
1926
return stringTag
2027
}

0 commit comments

Comments
 (0)