[Utils > unfreeze] Add
This commit is contained in:
parent
a9cc702956
commit
19359529e9
1 changed files with 8 additions and 0 deletions
8
src/lib/utils/unfreeze.ts
Normal file
8
src/lib/utils/unfreeze.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
// https://stackoverflow.com/a/68339174
|
||||||
|
|
||||||
|
export function unfreeze(obj: object) {
|
||||||
|
if (Object.isFrozen(obj)) {
|
||||||
|
return Object.assign({}, obj);
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
Loading…
Reference in a new issue