Continued creating the entity system

This commit is contained in:
Tiago Ribeiro
2024-10-01 17:39:43 +01:00
parent bae02e5192
commit 564e6438cb
37 changed files with 2522 additions and 130 deletions

View File

@@ -43,3 +43,11 @@ 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 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));