Started working on the assignments page

This commit is contained in:
Tiago Ribeiro
2024-10-02 19:20:05 +01:00
parent 564e6438cb
commit 3d4a604aa2
25 changed files with 2225 additions and 688 deletions

View File

@@ -44,10 +44,7 @@ export const convertBase64 = (file: File) => {
});
};
export const mapBy = <T>(obj: T[], key: keyof T) => {
if (!obj) return undefined;
return obj.map((i) => i[key]);
};
export const mapBy = <T>(obj: T[] | undefined, key: keyof T) => (obj || []).map((i) => i[key]);
export const filterBy = <T>(obj: T[], key: keyof T, value: any) => obj.filter((i) => i[key] === value);
export const serialize = <T>(obj: T): T => JSON.parse(JSON.stringify(obj));