diff --git a/src/def.d.ts b/src/def.d.ts index 0443c74..bfe7838 100644 --- a/src/def.d.ts +++ b/src/def.d.ts @@ -390,6 +390,7 @@ interface VendettaObject { findInTree: (tree: SearchTree, filter: SearchFilter, options: FindInTreeOptions) => any; safeFetch: (input: RequestInfo | URL, options?: RequestInit) => Promise; unfreeze: (obj: object) => object; + without: (object: O, ...keys: K) => Omit; }; debug: { connectToDebugger: (url: string) => void; diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index 6584f68..68502cf 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -2,4 +2,5 @@ export { default as findInReactTree } from "@utils/findInReactTree"; export { default as findInTree } from "@utils/findInTree"; export { default as safeFetch } from "@utils/safeFetch"; -export { default as unfreeze } from "@utils/unfreeze"; \ No newline at end of file +export { default as unfreeze } from "@utils/unfreeze"; +export { default as without } from "@utils/without"; \ No newline at end of file diff --git a/src/lib/utils/without.ts b/src/lib/utils/without.ts new file mode 100644 index 0000000..dd7567e --- /dev/null +++ b/src/lib/utils/without.ts @@ -0,0 +1,5 @@ +export default function without(object: O, ...keys: K): Omit { + const cloned = { ...object }; + keys.forEach((k) => delete cloned[k]); + return cloned; +} \ No newline at end of file diff --git a/src/lib/windowObject.ts b/src/lib/windowObject.ts index dca7812..8fb6540 100644 --- a/src/lib/windowObject.ts +++ b/src/lib/windowObject.ts @@ -17,18 +17,12 @@ import * as assets from "@ui/assets"; import * as color from "@ui/color"; import * as utils from "@utils"; -function without(object: O, ...keys: K): Omit { - const cloned = { ...object }; - keys.forEach((k) => delete cloned[k]); - return cloned; -} - export default async (unloads: any[]): Promise => ({ - patcher: without(patcher, "unpatchAll"), + patcher: utils.without(patcher, "unpatchAll"), metro: { ...metro, common: { ...common } }, constants, utils, - debug: without(debug, "versionHash", "patchLogHook"), + debug: utils.without(debug, "versionHash", "patchLogHook"), ui: { components, toasts, @@ -36,9 +30,9 @@ export default async (unloads: any[]): Promise => ({ assets, ...color, }, - plugins: without(plugins, "initPlugins", "evalPlugin"), - themes: without(themes, "initThemes"), - commands: without(commands, "patchCommands"), + plugins: utils.without(plugins, "initPlugins", "evalPlugin"), + themes: utils.without(themes, "initThemes"), + commands: utils.without(commands, "patchCommands"), storage, settings, loader: {