(obj: K | T)
| 542 | }; |
| 543 | |
| 544 | export function stripUndefined<T extends Record<string, unknown>, K = T | undefined>(obj: K | T): K | T { |
| 545 | if (!obj || typeof obj !== "object") return obj; |
| 546 | const keys = Object.keys(obj); |
| 547 | if (!keys.length) return obj; |
| 548 | const result = {} as T; |
| 549 | for (const k of keys as (keyof T)[]) { |
| 550 | const v = (obj as T)[k]; |
| 551 | if (v !== undefined) result[k] = v; |
| 552 | } |
| 553 | return result; |
| 554 | } |
no test coverage detected