From d4e192474f40a82cf596ff489801322940847212 Mon Sep 17 00:00:00 2001 From: Arjun Patel Date: Tue, 26 Mar 2024 09:32:52 -0400 Subject: [PATCH] cr --- src/utils/object/deleteNestedKey.ts | 2 +- src/utils/object/omit.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/utils/object/deleteNestedKey.ts b/src/utils/object/deleteNestedKey.ts index 6847db7588..8d37d54237 100644 --- a/src/utils/object/deleteNestedKey.ts +++ b/src/utils/object/deleteNestedKey.ts @@ -17,7 +17,7 @@ export function deleteNestedKey( keyToUpdate: string | string[], redactedString?: string, ): Partial { - const deleteKey = (currentObject: any) => { + const deleteKey = (currentObject: { [key: string]: any }) => { Object.keys(currentObject).forEach((key) => { if (key === keyToUpdate || keyToUpdate?.includes(key)) { if (redactedString) { diff --git a/src/utils/object/omit.ts b/src/utils/object/omit.ts index 2bfa346bde..8ed30d2242 100644 --- a/src/utils/object/omit.ts +++ b/src/utils/object/omit.ts @@ -1,10 +1,8 @@ -import { deleteNestedKey } from "./deleteNestedKey"; - export const omit = ( obj: T, params: K, ) => { const newObj = { ...obj }; - deleteNestedKey(newObj, params as string[]); + params.forEach((param) => delete newObj[param]); return newObj as Omit; };