10 lines
214 B
TypeScript
10 lines
214 B
TypeScript
|
export const removeUndefinedProps = <T>(obj: T): T => {
|
||
|
let newObj: any = {}
|
||
|
|
||
|
for (let key of Object.keys(obj)) {
|
||
|
if ((obj as any)[key] !== undefined) newObj[key] = (obj as any)[key]
|
||
|
}
|
||
|
|
||
|
return newObj
|
||
|
}
|