mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-18 08:02:03 +03:00
13 lines
253 B
TypeScript
13 lines
253 B
TypeScript
|
export const removeUndefined = <T extends Record<string, unknown>>(
|
||
|
obj: T
|
||
|
): Partial<T> => {
|
||
|
const newObj = {} as Partial<T>;
|
||
|
for (const key in obj) {
|
||
|
if (obj[key] !== undefined) {
|
||
|
newObj[key] = obj[key];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return newObj;
|
||
|
};
|