fix: crate or update user

This commit is contained in:
xavidop
2025-07-23 16:57:16 +02:00
parent f1edae23ce
commit c7f4ff9899
3 changed files with 24 additions and 2 deletions
+14
View File
@@ -4,3 +4,17 @@ import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
/**
* Removes undefined values from an object to prevent Firestore errors
* @param obj The object to filter
* @returns A new object with undefined values removed
*/
export function filterUndefinedValues<T extends Record<string, any>>(obj: T): Partial<T> {
return Object.entries(obj).reduce((acc, [key, value]) => {
if (value !== undefined) {
acc[key as keyof T] = value;
}
return acc;
}, {} as Partial<T>);
}