diff --git a/src/core/vendettaObject.ts b/src/core/vendettaObject.ts index 414d706..a98daa5 100644 --- a/src/core/vendettaObject.ts +++ b/src/core/vendettaObject.ts @@ -71,7 +71,7 @@ export const createVendettaObject = (unloads: any[]): any => ({ findInReactTree: (tree: { [key: string]: any; }, filter: any) => utils.findInReactTree(tree, filter), findInTree: (tree: any, filter: any, options: any) => utils.findInTree(tree, filter, options), safeFetch: (input: RequestInfo | URL, options?: RequestInit | undefined, timeout?: number | undefined) => utils.safeFetch(input, options, timeout), - unfreeze: (obj: object) => utils.unfreeze(obj), + unfreeze: (obj: object) => ({ ...obj }), without: (object: any, ...keys: any) => utils.without(object, ...keys) }, debug: { diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index 75c5c27..d996960 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -7,5 +7,4 @@ export { findInTree } from "@lib/utils/findInTree"; export * as logger from "@lib/utils/logger"; export { safeFetch } from "@lib/utils/safeFetch"; export * as types from "@lib/utils/types"; -export { unfreeze } from "@lib/utils/unfreeze"; export { without } from "@lib/utils/without"; diff --git a/src/lib/utils/unfreeze.ts b/src/lib/utils/unfreeze.ts deleted file mode 100644 index 43a6a29..0000000 --- a/src/lib/utils/unfreeze.ts +++ /dev/null @@ -1,6 +0,0 @@ -// https://stackoverflow.com/a/68339174 - -export function unfreeze(obj: object) { - if (Object.isFrozen(obj)) return Object.assign({}, obj); - return obj; -}