( obj: T, properties: K[], )
| 74 | }; |
| 75 | |
| 76 | export const excludeProperties = < |
| 77 | T, |
| 78 | K extends string | keyof T, |
| 79 | R = Omit<T, K & keyof T>, |
| 80 | >( |
| 81 | obj: T, |
| 82 | properties: K[], |
| 83 | ): R => { |
| 84 | if (!obj) { |
| 85 | return obj as unknown as R; |
| 86 | } |
| 87 | |
| 88 | const clone = structuredClone(obj); |
| 89 | |
| 90 | properties.forEach((prop) => { |
| 91 | delete (clone as Record<string, unknown>)[prop as string]; |
| 92 | }); |
| 93 | |
| 94 | return clone as unknown as R; |
| 95 | }; |
no outgoing calls
no test coverage detected